I Need To Make A Mp3 File Uploader Which Also Lets You Add Things To The Database At The Same Time As Well As Uploading With A Random URL

Things That Need To Be Added To The Database Are Things Like
Keywords
Artist Image Url
Artist
Song Name
And Random URL

Can Anyone Please Help

    create a form asking for each item you want, and don't forget the file upload field. Then process it and insert the data as you would with any other insert query and store the mp3 on the server.

      i also need the upload script thats one of the main parts i cant make an upload script which uploads the mp3 file and i also need it to use random urls and limit file types to mp3

        As for an upload script, there are examples in the manual: [man]features.file-upload[/man].

        As for limiting the file type, verify that it is "mp3" using [man]pathinfo/man (and supplying PATHINFO_EXTENSION as the second parameter, of course).

          1. Create a form
            [indent]

            <form name="mp3upload" action="upload.php" enctype="multipart/form-data">
                <label for="mp3">mp3 File:</label>  <input type="file" id="mp3" name="mp3" /><br />
                <input type="submit" name="submit" value="Upload" />
            </form>

            [/indent]

          2. Use PHP to verify it's uploaded:
            [indent]

            <?php
            if(isset($_POST))
            {
                if(is_uploaded_file($_FILES['mp3']['tmp_name']))
                {
                    // File is uploaded correctly
                }
                else
                {
                    // File isn't uploaded correctly
                }
            }
            else
            {
                // Nothing posted, show the form
            }

            [/indent]

          3. If the type is of audio/mpeg, then move it to the proper folder
            [indent]

                    // File is uploaded correctly
                    if($_FILES['mp3']['type'] == 'audio/mpeg')
                    {
                        if(!move_uploaded_file($_FILES['mp3']['tmp_name'], '/path/to/your/uploads/dir/' . $_FILES['mp3']['filename']))
                        {
                            // File was moved successfully!
                        }
                        else
                        {
                            // File was not moved successfully
                        }
                    }
                    else
                    {
                        // File is not of the audio/mpeg type
                    }

            [/indent]

          Help you out? Next time, before you offer to pay for someone to do it, how about you actually give us the code you're working with and explaining what exactly isn't working. Then we could help you move through the process of developing a file upload instead of spoon-feeding you the information as I have just done.

            5 years later

            Thanks for this informative post.I should try this one.

              Write a Reply...