i am using dropzone.js
in my project , what i want to do is add file manually to queue without opening the file browser dialogue, the dropzone is already initialized on the element with class .imageDropzone on the page and i am trying to run the following script to add the file ,
Dropzone.autoDiscover=false;
var myZone=Dropzone.forElement('.imageDropzone');
var fileList=$("input[accept='image/jpg,image/gif,image/png,image/jpeg']")[0].files;
fileList.name="imageUploadTestJPG.jpg";
fileList.type="image/jpeg";
fileList.size=30170,
fileList.path="http://mysite/img/imageUploadTestJPG.jpg";
fileList.mozFullPath="http://mysite/img/imageUploadTestJPG.jpg";
fileList.accept="image/jpg,image/gif,image/png,image/jpeg";
console.log(fileList);
myZone.addFile(fileList);
why am I doing this
1. I am working with php-webdriver and I need to test the upload functionality,
2. The file browser dialogue that is opened after clicking on a file type input is OS dependent, different in different OS, and I cant shift control to that window, so I wanted to skip this process of opening the file dialogue by clicking on it and want to add the file manually javascript/jquery and keeping autoProcessFiles=true
so that as soon the file is added the upload process starts, but I am unable to solve it.
when i try to call Dropzone.addFile()
i receive the following
TypeError: Argument 2 of FormData.append does not implement interface Blob
I event tried another way i.e
1. Add the file path to the file input on which the dropzone was initialized because dropzone binds an change eventlistener
with all the file inputs
which are initialized with dropzone and as soon the path to file is provided the change event listener
triggers and starts uploading the file, but trying to modify the value for file input with dropzone initialized raised security exception.
2. Moreover the <input type=file>
is made hidden by the dropzone.js
script when initialized and php-webdriver does not allow to interact with hidden elements so i am stuck with this, any help or guidance would be appreciated.