Uploaded Images do not desply, Why is that?

Discussion in 'PHP' started by madura99, Sep 17, 2007.

  1. #1
    I 'm developing a web site using php & mysql.:)
    There is a functionality which user can upload images for their profile. and Others can view those uploaded images by entering to the particular user's profile page. :cool: When user uploading the image in the back end its create a folder name it using userID (ex; user1234) and particular image will be placed to this folder and image path is stored in the DB. when displaying user profile its refer images which has been uploaded (path retrieve from db which has stored earlier). I have tested this using windows platform (WAMP) and worked as I desired. but now I have deploy this web site in a Linux base server(LAMP). problem is now those uploaded images doesn't display in the site. then I check the server and saw images has been uploaded as desired. then I back up those uploaded image folders and delete them from the server. Thereafter after I placed backup image folder again. now its working. Anybody can tell me the reason. why it is not directly referring those images?? :confused:.
     
    madura99, Sep 17, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    You need to post your code.
     
    nico_swd, Sep 18, 2007 IP
  3. webrickco

    webrickco Active Member

    Messages:
    268
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Contrary to windows based servers, Unix one are case sensitive in terms of paths. Copy your image paths from your database directly to the browser to see if the image is there. That's just an idea.

    Anyway, having the code would provide a better understanding.
     
    webrickco, Sep 18, 2007 IP
  4. madura99

    madura99 Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanx for ur idea but the case is not with the code. because I backed up those image folder into my machine and delete them from the server. then I placed those backed up image files folder into the server again. then itz working without having a problem. I feel issue is related to folder permission or file permission. by the way any thoughts on that??
    still if u feel, u need code then I can send you
     
    madura99, Sep 18, 2007 IP
  5. webrickco

    webrickco Active Member

    Messages:
    268
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #5
    If the functionality of loading the image file on the server is working properly then it your privilege is high enough to read and display it from the server.

    After uploading the image to the server, if you take the URL created in the DB and paste it directly in the browser address bar, without having backed up your files back and forth, does it display the image alone? if it does, please put down the php code used to retrieve the path from the DB to display the image.
     
    webrickco, Sep 18, 2007 IP
  6. DopeDomains

    DopeDomains Guest

    Messages:
    207
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Look at the privileges of the created folder. and compare that to folders that can display information. Most shared hosting apache servers require that web accessible folders be set to RWXR.XR.X (or 755) and files be RW.R..R.. (644) I am guessing that the directories and or files are being created with different privileges.

    -Jason
     
    DopeDomains, Sep 18, 2007 IP
  7. DopeDomains

    DopeDomains Guest

    Messages:
    207
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I meant to add:

    To change the privileges, try using chmod($PATH,'0755') (not the leading 0).

    -Jason
     
    DopeDomains, Sep 18, 2007 IP
  8. madura99

    madura99 Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thnx DopeDomains and all,

    Problem was related to permission while creating the Folder.
    i hv ser it to 0700 (mkdir($targetPath, 0700); ) :eek:

    I change it to mkdir($targetPath, 0755); :p :cool:
    now itz working thanx to u all

    keep it up
    cheers

    - Madura
     
    madura99, Sep 18, 2007 IP