Hello folks,
I have a form with a File Input object on it. When I browse for and select a file, then save the record, the file is converted to JSON and saved in the table as expected. However, if i re-open this record, the File input shows "No file selected". There is no indication that a file has already been uploaded. Is there a way to show the filename here so I know what was uploaded?
Also, if I have two files with the same name, but in different folders, how can I know which version was uploaded (the JSON contains the filaname, but not the full path).
Cheers,
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 Input object
-
- nuBuilder Team
- Posts: 4304
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: File Input object
Retrieve the file name of the file input object (e.g. fileupload) when saving the form and store it in a different field (e.g. filename)
Code: Select all
var f = $('#fileupload').prop('files');
if (f.length > 0) {
$('#filename').val(f[0].name).change();
}
-
- Posts: 9
- Joined: Thu May 05, 2016 5:25 am
Re: File Input object
Thanks Kevin,
Of course your suggestion will work, but I was surprised the functionality was not included in the File object itself. Every other input object on an edit form shows it's contents when you open the record, but not the File object (unless I am misusing it?). I can understand not showing the file contents themselves (particularly if it's a large file), but it would be helpful if the filename or better still the path could be shown to indicate the field is not empty.
Any comments Steven?
Cheers,
Of course your suggestion will work, but I was surprised the functionality was not included in the File object itself. Every other input object on an edit form shows it's contents when you open the record, but not the File object (unless I am misusing it?). I can understand not showing the file contents themselves (particularly if it's a large file), but it would be helpful if the filename or better still the path could be shown to indicate the field is not empty.
Any comments Steven?
Cheers,
Re: File Input object
miketee,
The File Input object is an HTML, element. - that is the way it works.
kev1n's suggestion is a good one.
Steven
The File Input object is an HTML, element. - that is the way it works.
kev1n's suggestion is a good one.
Steven