You are viewing limited content. For full access, please sign in.

Question

Question

Can't get file name when using drag and drop for file upload

asked on October 23, 2019

I am using the name of a file uploaded for name purposes and to fill out fields in subsequent forms in a process.

 I used the following code from this Laserfiche Answer post with just a minor change.

https://answers.laserfiche.com/questions/144900/File-Upload-Name-Change#144922

   
$(document).ready(function(){


$('#q5 input').on('change', function() {
      var filename = $('input[type=file]').val().split('\\').pop().slice(0,-4);
       $('#q16 input').val(filename);
      })


  })

 

 

This code works perfectly when I click the upload button and adds a document. However when I try to use the drag and drop feature to upload a document  the hidden textbox I use to store the file name does not get populated.

 

My question is why does this not seem  to work if it is still a change event(or am I mistaken)?

Is there a way to disable the drag and drop ability if I can't get the name to populate correctly?

0 0

Replies

replied on January 20, 2022

I'm also interested in this, because if the "#q16" field is required, the form doesn't recognize that it has been filled with the filename.  I'd like to show other fields based on whether an upload has been added or not.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.