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 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Renaming upload files

    can anyone help me with my renaming method..here is the current code i use to upload files http://pastebin.ca/14234, and i'm attempting to make it so each file is renamed to a number and then attached with the appropiate extension so far i have this..but it doesn't work at all..here is what i got so far...http://pastebin.ca/14235
    Thanks in advance for the help.

    Daum

  • #2
    Regular Coder Coastal Web's Avatar
    Join Date
    Oct 2004
    Posts
    225
    Thanks
    12
    Thanked 3 Times in 3 Posts
    I dont understand, why wouldn't something like:

    PHP Code:
    <?php
    //some variables...

    $userfile "user_uploaded_file.html";
    $ext substr($userfilestrrpos($userfile,"."));
    $time time();
    $newname $time.$ext;

    /*
    And of course you'd copy the uploaded file and put it where you wanted it...

    copy($file_temp, "$newname") or die('could not upload file');
    */

    echo <<<end
    Your file is named: $userfile
    <br>
    It has a $ext extension
    <br>
    I will rename your file: 
    $newname
    end;
    ?>
    Do the trick?

    Samantha Gram


  •  

    Posting Permissions

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