Jump to content

help with multiple file upload.


rockoclark

Recommended Posts

I got this php code online to load m3p files to my server, and it works good except I would like to be able to upload multiple songs at once by adding more file upload boxes. I have tried on my own but I cannot seem to get it right. I have just started to learn php on my own so I am still new to it all. Thank you for any help.

 

 

here is the form html:

 

 

<form action="/loadmp3.php" method="post" enctype="multipart/form-data">

 

<input type="file" name="file" size="40" />

 

<br /><br />

 

<input type="submit" name="submit" value="Upload" />

 

<br /><br />

 

<span style="font-family: verdana; font-size: 12px;">* only mp3 files under 16 megabytes are allowed.</span>

 

</form>

 

 

 

 

 

and this is the php:

 

<?php

 

if($_POST['submit']=="Upload") {

    if ($_FILES['file']['name'] != "") {

            if (($_FILES['file']['type'] == "audio/mpeg") || ($_FILES['file']['type'] == "application/force-download")) {

                if ($_FILES["file"]["size"] < 16777216) {           

                        move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);

                      echo "File has been stored in your uploads directory.";}

else {    echo "Please upload a file that is under 2 mb!";}

} else {

    echo "Please upload a mp3 file!";

    exit;}

} else {    echo "Please enter a file.";}

}

?>

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/255122-help-with-multiple-file-upload/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.