I'm using the jQuery file upload plugin which has an API to programmatically upload files. The documentation writes:
$('#fileupload').fileupload('add', {files: filesList});
The problem is that I don't know what filesList
should be. I have tried the following unsuccessfully:
$('#fileupload').fileupload('add', {files: ['/Users/bob/Desktop/test.png']});
What should filesList
be exactly?
To quote the documentation:
The second argument must be an object with an array (or array-like list) of File or Blob objects as files property.
You can get file objects using the files property of a file type input or the HTML5 File API.
For more detail regarding working with the FileAPI and file inputs see: MDC - Using files from web applications