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!