Results 1 to 3 of 3

Thread: totally baffled

  1. #1
    Join Date
    Jan 2008
    Posts
    10
    Tokens
    0

    Default totally baffled

    yer i have an image upload script but the thing is when uses upload an image if it has the same filename as one already uploaded it doesnt work..

    so what can i add to my upload script so it changes the filename?

  2. #2
    Join Date
    Jan 2007
    Location
    Canada eh?
    Posts
    766
    Tokens
    75

    Default

    Well you could start by posting your original script... basically what you would need to do is:

    Pseudo Code:
    PHP Code:
    <?php
    // Do Uploading bit here...
    $ext Uploaded Files Extension (.gif, .jpgetc.);
    $filename rand(9).rand(9).rand(9).rand(9).rand(9).rand(9).rand(9);
    $newfile $filename.$ext;
    if(
    file_exists($newfile)){
         
    // Try again for a new filename
    }else{
         
    // Upload file with the new filename
    }
    ?>
    Note that "Pseudo Code" won't actually do what you're in need of but just provides an example of the logic you should use
    Last edited by QuickScriptz; 08-01-2008 at 10:03 PM.

  3. #3
    Join Date
    Jan 2008
    Posts
    10
    Tokens
    0

    Default

    nevermind..

    Sorted it..
    Last edited by Randomer; 08-01-2008 at 10:09 PM.

Posting Permissions

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