Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Upload File PHP

  1. #1
    Regular Coder
    Join Date
    Apr 2006
    Posts
    231
    Thanks
    9
    Thanked 1 Time in 1 Post

    Upload File PHP

    Hey all,

    I have a php script that uploads songs to a directory and then I move them from there once I verify that they are the correct songs.

    I have said Please have the song in Artist-SongName name mode, but about 50% of the idiots don't follow this so they just upload the song. Now, That's fine, I guess. I probably wouldn't take my time either since there's no real benefit.

    I was wondering if I can do something to the php upload script that renames the file to:

    $artist-$filename.ext (assuming $filename.ext is the file)

  • #2
    Regular Coder goughy000's Avatar
    Join Date
    Nov 2005
    Location
    England
    Posts
    415
    Thanks
    0
    Thanked 0 Times in 0 Posts
    do people fill out what the song name and artist is in the form with the upload?
    PHP Freelancing!
    ByteForums!
    Scriptlance.comNeed a job done quick? post it on scriptlance! OR! your a programmer? sign up and get paid for these jobs!

  • #3
    Regular Coder
    Join Date
    Apr 2006
    Posts
    231
    Thanks
    9
    Thanked 1 Time in 1 Post
    No sir.

    The upload file is within the artist page, which means that the artist is pre-defined in the page already (via mysql query).

    I have all the variables, I just dont know how to re-name the file to what I want it.

  • #4
    Regular Coder goughy000's Avatar
    Join Date
    Nov 2005
    Location
    England
    Posts
    415
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    <?php
    rename
    ($filename$artist."-".$filename);
    ?>
    PHP Freelancing!
    ByteForums!
    Scriptlance.comNeed a job done quick? post it on scriptlance! OR! your a programmer? sign up and get paid for these jobs!

  • #5
    Regular Coder
    Join Date
    Apr 2006
    Posts
    231
    Thanks
    9
    Thanked 1 Time in 1 Post
    Quote Originally Posted by goughy000 View Post
    PHP Code:
    <?php
    rename
    ($filename$artist."-".$filename);
    ?>
    Do I need to set a new variable with this function, or does it just do it and I'm good to go?

  • #6
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    You should check the filename before you move it and correct it in move_uploaded_file();


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •