Hi. I have a table with a file upload. I would like to retrieve the file name when the file is uploaded.
Question
Question
Replies
Hello, I haven't done uploods in a table, but on a normal upload, the filenames do show up in the variables.
The vars in the table rows can also be accessed as variables in a workflow and template. But you would have to probably have another step in your forms process to pass the name of the file into a field in a table row.
Hi Cris, if you would like to retrive the file name right after you upload it on the fill form page, you can refer to custom scripts in this post: https://answers.laserfiche.com/questions/144900/File-Upload-Name-Change
Thanks. I've tried, but it didn't work for a table.
It need to be modified to work in table, here is an example:
$(document).ready(function () { function fileOnChange(event) { var filename = $(event.target).val().split('\\').pop(); $(event.target).closest('tr').find('.name-field input').val(filename); } $('.file-field input').on('change', fileOnChange); $('#q4 .cf-table-add-row').click(function() { $('.file-field input').off('change', fileOnChange); $('.file-field input').on('change', fileOnChange); }); })
#q4 is the table field id, and this part is needed if you want to handle newly added rows in table; file-field need to be added as classname to file upload field, and name-field need to be added as classname to the file name field.