TAGS :Viewed: 3 - Published at: a few seconds ago

[ Get files from input.files instead of value on submit ]

I have following problem. I have input field in form, type of file:

 <FORM action="http://server.com/cgi/handle"
   What is your name? <INPUT type="text" name="submit-name"><BR>
   What files are you sending? <INPUT type="file" name="files"><BR>
   <INPUT type="submit" value="Send"> <INPUT type="reset">

I am setting using JavaScript also files property of this input and I want this input on submit of form send the file property instead of his value. Is it possible to do so?

var data = e.dataTransfer;    
var input = dojo.byId(inputName);
var file = data.files[i];
input.files[0] = file;

data is a datatransfer object, I am getting files from there.

I know, it will be possible only in few browsers, I dont care. I just need to get it working at least in FF.

Answer 1

So if I understand you correctly you drop some files and you want to populate a file input object

I see a drop example here http://help.dottoro.com/ljslrhdh.php

but to populate the file field you will need a pretty heavy privilege change using a signed script - UniversalFileRead is probably the one you need