Boxerman Posted August 11, 2011 Share Posted August 11, 2011 Hi guys, Just trying to work my head around how i would be able to create 2 uploads; 1) Mp3 upload 2) picture upload both i want to work the same; how would i get it so when a user uploads a mp3/picture it stores the filename in the database and there username and date/time uploaded? I'm just a little confused on how i would go about it. Thanks, B-Man Link to comment https://forums.phpfreaks.com/topic/244512-user-upload/ Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 11, 2011 Share Posted August 11, 2011 check the tutorial here, hope it helps File Upload Link to comment https://forums.phpfreaks.com/topic/244512-user-upload/#findComment-1255922 Share on other sites More sharing options...
Boxerman Posted August 11, 2011 Author Share Posted August 11, 2011 great its pointing me the right way! thanks pal! heres my html form: <form enctype="multipart/form-data" action="masterupload.php"> username <input type="text" name="username" size="35" /> <br /> song title <input type="text" name="song_title" size="35" /> <br /> About mix <textarea name="about" rows="4" cols="40"></textarea> <br /> Choose a file to upload: <input name="uploadedfile" type="file" /> <br /> <input type="submit" value="submit" /> </form> heres masterupload.php <?PHP $con = mysql_connect("localhost","",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); if ($_SERVER['REQUEST_METHOD'] == "POST") { $dir = "/users/mp3/"; $uploadfile = $dir . $_FILES['mp3_file']['name']; move_uploaded_file($_FILES['mp3_file']['tmp_name'], $uploadfile); $sql = "INSERT INTO $table (song_name, uploader, approved) VALUES ($_POST[song_name], $_POST[username], $_POST[approved],$uploadfile)"; mysql_query($sql); } ?> its not working, could someone lend a helping hand please? Thanks, B-Man Link to comment https://forums.phpfreaks.com/topic/244512-user-upload/#findComment-1256122 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.