简体   繁体   中英

Multiple Files upload PHP in Ubuntu

I am trying to upload multiple files (tsv,csv) using PHP. The HTML and PHP script is written below. It works for me when running with XAMPP on Windows. However, on Ubuntu,when trying upload 2 files at a time (one is tsv, the other is csv) I can only upload one file at a time, but not two. I am not sure what the reasons are but it seems that there is something needed to be done with the server settings.

The code below won't work if I upload both tsv and csv but it works with other file types.

<form action='' method='post' enctype="multipart/form-data">
<input type='file' name='usrfile[]'/>
<input type='file' name='usrfile[]'/>
<input type='submit' name='submit'/>
</form>

<?php
if(isset($_POST["submit"])){
    for($i=0;$i<=1;$i++){
        move_uploaded_file($_FILES["usrfile"]["tmp_name"][$i],"upload/" . $_FILES["usrfile"]["name"][$i]);//upload the ecwave file to the upload/ folder    
    }
}
?>

Make a look at the manual.

There is a max_file_uploads setting, which restricts the number of allowed files per form.

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