copying the value of a form's file input field to another form's input field

So I have two forms, both have a file type input field and I tried

   var file = $(this).val();

but then it doesn't get copied properly and firebug complains about "Security Error" in the error console

what did I do wrong and how can I properly copy the value of a file input field

by the way, the destination form has a target that is set to an iframe (not a different domain)



You can't move the value of one file input to another, it is a security risk. Instead, clone the input, place the clone where the original is, and move the original into the hidden form.

  var $this = $(this), $clone = $this.clone();

I know it is a late answer, but I had a similar problem that I just figured out today.

What I did was move the File input to the new location after deleting the current one in the other location. By moving the element, everything stayed intact on all my tests.

$('.inputfield1').change(function() {


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.