Uploading images

Discussion in 'PHP' started by MaxwellS, Oct 28, 2010.

  1. #1
    I'd like to make an image gallery that can upload multiple images from the user and store them in the user folder. Each image must have a unique name.

    How do I set up so each image gets a unique file name?

    Are there any advanced uploading forms available similar to ones used on facebook or myspace to upload multiple images?

    Thanks for your help!
     
    MaxwellS, Oct 28, 2010 IP
  2. fr33lanc3

    fr33lanc3 Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    When I have written code like you describe, I rename the file to include a timestamp and the position in the upload to make it unique.

    ie somefile.jpg would be renamed to 'somefile_position_' . time() . '.jpg';
    the result would look something like
    somefile_1_324347239.jpg
    If multiple files were uploaded, they would then look something like this:

    somefile_1_324347239.jpg

    somefile_2_324347245.jpg

    somefile_3_324347285.jpg
     
    fr33lanc3, Oct 29, 2010 IP
  3. kasun0777

    kasun0777 Well-Known Member

    Messages:
    355
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    138
    #3
    u can done this project with java
     
    kasun0777, Oct 29, 2010 IP
  4. daljit

    daljit Well-Known Member

    Messages:
    312
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #4
    When ever you upload a image .we split the file name and extension and then concatenate the time stamp in between the file or extension.just like
    $fil="image.jpg";
    $f=explode('.',$fil);
    $newfile=$f[0].time().$f[1];
    echo $newfile;

    i think this will help you ..
     
    daljit, Oct 31, 2010 IP
  5. Pedro Gorrin Diaz

    Pedro Gorrin Diaz Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    www . w3schools.com/php/func_misc_uniqid . asp will be helpful for you
     
    Pedro Gorrin Diaz, Oct 31, 2010 IP