file input type being used to select a file and then move the data to a form with the approperiate file input tag

I have an iframe which will have an input tag that allows you to browse for the file you are wanting to upload.

What i was then doing was creating a new input type = "file" tag in my hidden form data which would be populated with the src of the file.

At the end of everything there is a button the users can use to submit the actual form.

The submitted form, will have the file, but it would be empty. I was thinking there might be some underlying event going on that i didnt know about. When reading up on it, i also had noticed that if the source is wrong, it will just send an empty file.

How is this done correct?

Update: When looking at the data,the dom element input:file has an attribute called files which is the attribute i want to move to the new item. My fiddle is:

I cant seem to get new data to move over from the old input to the new input.

Edit: I was thinking that jQuery might be able to maintain data by copying the whole object. via the $(this).clone() command, but that was not working either.


Editing the file form field is a security risk and thus is disabled on most browsers.

See Clone a file input element in Javascript

In your scenario, I believe you could create two forms (one in the iframe) and submit both on the button request.

See Submit two forms with one button

Need Your Help

Simple pure java CSV reading and parsing

java csv delimiter filereader comma

I am stuck with file reading operation and need your help.

Using box-api in an ARC project?

ios automatic-ref-counting box-api

How can I use the box-api in a project using ARC?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.