I have a File Object (in a collection of other objects) in a subform. When I click the "browse" button on the File Object everything seems to work fine . . . file select window pops up, user selects file, filename shows up in the File Object on the subform. However, when I click save on the main form, the filename disappears from the File Object and is replaced with "No file selected." Something is getting saved in the underlying table, but it seems to only save the other objects on the subform, not the File Object.
I hope that is descriptive enough to give everyone a mental image of my problem.
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
File Object Not Saving File
-
- Posts: 68
- Joined: Sun Mar 04, 2018 6:38 pm
Re: File Object Not Saving File
Before adding a file
After selecting a file
After clicking "save"
You do not have the required permissions to view the files attached to this post.
TonyD
Re: File Object Not Saving File
tonyd,
That is the way it is supposed to work.
An Input:File Object is for selecting a file, not for displaying anything.
Just like in the Files Form.
Steven
That is the way it is supposed to work.
An Input:File Object is for selecting a file, not for displaying anything.
Just like in the Files Form.
Steven
You do not have the required permissions to view the files attached to this post.
-
- Posts: 68
- Joined: Sun Mar 04, 2018 6:38 pm
Re: File Object Not Saving File
I think I understand. Then what I need to know is whether I can store the file somewhere (database, filesystem, cloud) that would allow for later retrieval? The filesystem would be the best due to the expected large numbers of saved files, but that would go against the whole nuBuilder idea of keeping everything in one easy-to-manage location, the database. I know a MySQL database can hold quite large file sizes, but I just don't trust a database for file storage.
BTW, I am not really concerned (yet) with displaying the files.
BTW, I am not really concerned (yet) with displaying the files.
TonyD
Re: File Object Not Saving File
tonyd,
Even though an Input:File Object doesn't display the file name after it saves, it will still save the file to the database once you click the Save Button.
Steven
Even though an Input:File Object doesn't display the file name after it saves, it will still save the file to the database once you click the Save Button.
Steven
-
- Posts: 68
- Joined: Sun Mar 04, 2018 6:38 pm
Re: File Object Not Saving File
OK, is there a way within nuBuilder to download or view the file (assuming it is a PDF or graphics file) once it is in the database?
TonyD
Re: File Object Not Saving File
TonyD,
The File Button will lead you to a Form that has code that is used to display files.
This is that code...
Steven
The File Button will lead you to a Form that has code that is used to display files.
This is that code...
Code: Select all
nuSetNoSearchColumns([2,3]);
$('[data-nu-column="0"]').each(function( index ) {
var code = '#nucell_' + index + '_';
window.nuImages[$(code + '0').text()] = $(code + '2').text();
});
if(nuFormType() == 'browse'){
nuShowBrowseImages()
}else{
nuShowFile();
}
function nuBeforeSave(){
var f = $('#sfi_json_file').val();
if(f != ''){
$('#sfi_json')
.val(f)
.change();
}
return true;
}
function nuShowFile(){
var j = $('#sfi_json').val();
if(j == ''){return;}
var ob = JSON.parse(j)
var ty = ob.type;
var ur = atob(ob.file);
var x = document.createElement("EMBED");
x.setAttribute("type", ty);
x.setAttribute("src", ur);
x.setAttribute("width", "300px");
x.setAttribute("height", "300px");
$('#view_image').html('');
document.getElementById('view_image').appendChild(x);
}
function nuShowBrowseImages(){
$('[data-nu-column="0"]').each(function( index ) {
var p = $(this).attr('id');
var r = String(p).split('_')[1];
var i = "nucell_" + r + "_2";
var e = "nucell_" + r + "_3";
var h = $('#' + i).html();
if(h != '' && h !== undefined){
var ob = JSON.parse(h)
var ty = ob.type;
var ur = atob(ob.file);
var x = document.createElement("EMBED");
x.setAttribute("type", "embed" + i);
x.setAttribute("type", ty);
x.setAttribute("src", ur);
x.setAttribute("width", "140px");
x.setAttribute("height", "140px");
$('#' + e).html('');
document.getElementById(e).appendChild(x);
}
});
}
Steven
You do not have the required permissions to view the files attached to this post.
-
- Posts: 68
- Joined: Sun Mar 04, 2018 6:38 pm