开发者

Is it possible to have two "<input type=file>" within a single form?

开发者 https://www.devze.com 2023-01-23 21:54 出处:网络
Is it possible to have something like the following <form id=\"uploadForm\" action=\"upload.ashx\" method=\"post\" enctype=\"multipart/form-data\">

Is it possible to have something like the following

<form id="uploadForm" action="upload.ashx" method="post" enctype="multipart/form-data">
<p>Upload File 1</p>
<input type="file" name="file1"/>
<p>Upload File 2</p>
<input type="file" name="file2"/>
<input type="submit" value="Submit" />
</form>

I know I can use the Jquery Multi-File-Upload plugin to upload multiple files from a single input element. The situation is that the end user will be uploading multiple images of a product and I would like to be able to prompt them for sep. image for example one could be a front view and the second could be a back view. When I try the above HTML however I only see the first file being posted in Firebug.

Update:

Looks like thi开发者_如何学Pythons may be something with Firebug as when I modify the dest .ashx page to just spit back the filenames that it received from the post request I get both Files. Also in the Firebug console I see this message buried amongst the posted data ... Firebug request size limit has been reached by Firebug. ...


The inputs have the same name. Change the names or in PHP for example you can use the shortcut name=file[] and have an array


That works fine for me. The files are being uploaded to my server just fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号