简体   繁体   中英

JQuery Multi File Upload

I have a problem in which I need to upload multiple files using multipart POST request, I need a single browse button to choose the uploaded files. I've seen JQuery Plugin for multi file upload, but there is a problem that only one file is uploaded several times. the post request file parameters are sent with the same name. My question is how to deal with this behaviour so that file params are sent with different names?

Here is the my HTML:

<form id="uploadFormId" name="uploadForm" method="POST" enctype="multipart/form-data" action="http://...">
<input type="file" name="MultiFile" id="uploadFileId" class="multi"/>
<input type="submit" value="Upload"/>

Thanks

You need to make your files name an array, as in:

    <input type="file" name="MultiFile[]" id="uploadFileId" class="multi"/>

then when checking for your $_FILES, you run a "foreach" php command.

I think this link has a good example of uploading multiple files.

http://davidwalsh.name/multiple-file-upload

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM