rockoclark Posted January 16, 2012 Share Posted January 16, 2012 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.";} } ?> Quote Link to comment https://forums.phpfreaks.com/topic/255122-help-with-multiple-file-upload/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.