shubh2488 Posted November 29, 2011 Share Posted November 29, 2011 Hello i need help, I am creating a small social networking website in which i want dat a user can upload music files as well with some descriptions ,the description and file path should be stored in database and the mp3 file should be stored in a seprate folder i want a PHP script for this. If any one knows it then please help me. Quote Link to comment https://forums.phpfreaks.com/topic/252035-multiple-audio-file-upload/ Share on other sites More sharing options...
Pikachu2000 Posted November 29, 2011 Share Posted November 29, 2011 Post your code and the problems you're having. Include any error messages, also. Quote Link to comment https://forums.phpfreaks.com/topic/252035-multiple-audio-file-upload/#findComment-1292165 Share on other sites More sharing options...
shubh2488 Posted November 30, 2011 Author Share Posted November 30, 2011 Post your code and the problems you're having. Include any error messages, also. <?php if(isset($_POST)) { if(is_uploaded_file($_FILES['ufile']['tmp_name'])) { // File is uploaded correctly if($_FILES['ufile']['type'] == 'audio/mpeg') { if(!move_uploaded_file($_FILES['ufile']['tmp_name'], '/upload/' . $_FILES['ufile']['filename'])) { echo" File was moved successfully!"; } else { echo" File was not moved successfully"; } } else { // File is not of the audio/mpeg type } } else { echo"File isn't uploaded correctly"; } } else { // Nothing posted, show the form } ?> the output is "File isn't uploaded correctly" Quote Link to comment https://forums.phpfreaks.com/topic/252035-multiple-audio-file-upload/#findComment-1292485 Share on other sites More sharing options...
Pikachu2000 Posted November 30, 2011 Share Posted November 30, 2011 At the beginning of the script, add the following, and post the output it generates after the form has been submitted. echo '<pre>'; print_r($_POST); echo '</pre><br><br><pre>'; print_r($_FILES); echo '</pre>'; Quote Link to comment https://forums.phpfreaks.com/topic/252035-multiple-audio-file-upload/#findComment-1292487 Share on other sites More sharing options...
shubh2488 Posted November 30, 2011 Author Share Posted November 30, 2011 <?php echo '<pre>'; print_r($_POST); echo '</pre><br><br><pre>'; print_r($_FILES); echo '</pre>'; if(isset($_POST)) { if(is_uploaded_file($_FILES['ufile']['tmp_name'])) { // File is uploaded correctly if($_FILES['ufile']['type'] == 'audio/mpeg') { if(!move_uploaded_file($_FILES['ufile']['tmp_name'], '/upload/' . $_FILES['ufile']['filename'])) { echo" File was moved successfully!"; } else { echo" File was not moved successfully"; } } else { // File is not of the audio/mpeg type } } else { echo"File isn't uploaded correctly"; } } else { // Nothing posted, show the form } ?> i am attaching the jpeg image of my output hav a look i choose mp3 file for uploading [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/252035-multiple-audio-file-upload/#findComment-1292491 Share on other sites More sharing options...
Pikachu2000 Posted November 30, 2011 Share Posted November 30, 2011 That isn't the output . . . Quote Link to comment https://forums.phpfreaks.com/topic/252035-multiple-audio-file-upload/#findComment-1292492 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.