SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2009
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Upload image to a folder and display

    Hello friends... can help me to upload the image to an folder how can i do it pls tell and i need to display it from the folder...pls help me through the coding where i need to pass all type of imagess like jpg,png,gif after all i need it very urgent if you can pls explain me through the codes....

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    We aren't here to do your work for you.

    So, try it yourself and if you have problems, come back.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2009
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hello friend i have the code to upload the image but the problem comes for me how to call it back from folder like how can i tell i need to make the folder automatically and upload the image inside tht and display the image to the page... i know how to make the uploading but how to create a folder automatically and display the image from their thts the doubt for me

  4. #4
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Ok, well to create a folder you use the mkdir() function - to see if it already exists use file_exists:
    PHP Code:
    $Directory 'Uploads'
    if(!file_exists($Directory)){
        
    mkdir($Directory) or die('Cannot create upload directory. @Admin: Make sure permissions are correct');

    To display the image:
    PHP Code:
    printf('<img src="%s/%s" alt="uploaded image" />'$Directory$ImageName); 
    If you need more assistance, can you post what code you have at the moment?
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  5. #5
    SitePoint Zealot
    Join Date
    Jul 2009
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok friend thank you for the responce see wht i have done for the image uploading while uploading any 1 will upload with the same name of the image which is already their in the folder... to avoid this i addded the time(). function with the image name so the thing is that the problems comes if the user gone and he will come back in his login file he should see all his images from the folder tht i know how to do but i dont know how to delete this image from the folder...... if you know tell me and thank for the helping mentality really i am new to this image php play thts why..


Bookmarks

Posting Permissions

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