Can't touch file upload elements with javascript
Son of a %#@%$. I was in the process of adding a slick feature to a complicated HTML form and ran into an unexpected problem.
The "form" has some input elements outside the actual <form> tag. The values from these elements are packaged up a certain way and injected into a hidden text field during the form submit process. Works like a charm.
I wanted to add the ability to upload files using this same basic mechanism -- create an <input type="file"> element inside the <form> based on info entered outside the form. It turns out that this isn't possible because the browser won't allow programmatic manipulation of file upload elements. Now that I think about it, the reason for this is painfully obvious.
I also tried moving the DOM node from its original location to a location inside the <form> (the data attached to the node was still entered by the user). No dice on that either.
Crap.
The "form" has some input elements outside the actual <form> tag. The values from these elements are packaged up a certain way and injected into a hidden text field during the form submit process. Works like a charm.
I wanted to add the ability to upload files using this same basic mechanism -- create an <input type="file"> element inside the <form> based on info entered outside the form. It turns out that this isn't possible because the browser won't allow programmatic manipulation of file upload elements. Now that I think about it, the reason for this is painfully obvious.
I also tried moving the DOM node from its original location to a location inside the <form> (the data attached to the node was still entered by the user). No dice on that either.
Crap.
