2

I have a function will create a fileinput field for example

function addCol () {
   //add file input fields

   //last line of the function will bind all file input fields to a function
   $('#upload_'+rowNum[1]+'_'+colSize).bind('change', {fh:'upload_'+rowNum[1]+'_'+colSize}, readURL);
}

The function

function readURL(e) {
    alert(e.data.fh);
    var input = $('#'+e.data.fh);
    alert(input.files);
}

As a result,

e.data.fh = 'upload_1_1'
input.files = undefined

Anyone know how I can retrieve the file from the file input fields dynamically?

1
  • @Zamboney it works, you can make your comments as answer Commented Mar 30, 2016 at 7:46

1 Answer 1

1

try e.target.files[0] the e.target return the html tag <input type="file"> and in this tag there is a property call files that contain all of the files that been loaded

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.