Jump to content

Multiple Audio file upload


shubh2488

Recommended Posts

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.

Link to comment
Share on other sites

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"

Link to comment
Share on other sites


<?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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.