jubba890 Posted November 20, 2013 Share Posted November 20, 2013 (edited) Hi all once again! I would just like to say this forum is amazing! I need to upload a file to my server in /StreamIT/media/music And in the page where you select the file I need there to be some boxes you need to fill in Song: Artist: Album: Category [This needs to be dropdown box] Is it clean? [A yes/no type thing] This needs to be on one page and I need it too add those fillouts to a MYSQL database I also need a php script to get all the fields from the MYSQL database The code I have so far: [Does not work] upload_file.php <?php $allowedExts = array("mp3"); $temp = explode(".", $_FILES["file"]["name"]); $extension = end($temp); if ((($_FILES["file"]["type"] == "mp3") && ($_FILES["file"]["size"] < 20000) && in_array($extension, $allowedExts)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>"; if (file_exists("music/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "music/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?> And uploadm.php [Works] <html> <body> <form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file"><br> <input type="submit" name="submit" value="Submit"> </form> </body> </html> I know I am asking a lot. Thank you guys! Edited November 20, 2013 by jubba890 Quote Link to comment Share on other sites More sharing options...
Solution MDCode Posted November 20, 2013 Solution Share Posted November 20, 2013 What have you tried so far? No one is going to sit here and write it completely. The best you'll get is a template. Here's a thing to consider: 20000 bytes is 0.02MB (give or take). That will deny most if not all music files. Quote Link to comment Share on other sites More sharing options...
jubba890 Posted November 20, 2013 Author Share Posted November 20, 2013 What have you tried so far? No one is going to sit here and write it completely. The best you'll get is a template. Here's a thing to consider: 20000 bytes is 0.02MB (give or take). That will deny most if not all music files. It was a test file I didnt want to upload a file that was 10MB for the sake of time. I am a newbie at this so I don't know where to start. Quote Link to comment Share on other sites More sharing options...
jubba890 Posted November 22, 2013 Author Share Posted November 22, 2013 I might be able to pay money for this project if anyone can help Quote Link to comment 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.