Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.