Hi everyone,i'm a newbie to php/mysql and also this forum. I have images on the server inside a folder, i'm retrieving images via the path saved in my mysql table. but they don't appear on the pages(www.neshclick.co.za), and i've also set the folder permissions to 7 5 5 but still they still don't appear. any help will be much appreciated. Thanks in advance.
If you're saying that the path of the images was saved on your table, clearly the problem lies on your PHP script / program that is task to retrieve it. Check your PHP Code.
ok, here's my absolute path: home/username/public_html/admin/uploads/image_name.jpg, here's my image code <img src="<?php echo '../public_html/admin/'.$path; ?>" /> maybe you can help me with the relative path, i've tried but i'm waisted. Thanks
This will not work as the client that is viewing the image does not have access to files beneath the public_html. To Fix this, do this: <img src="viewimage.php?name=$path" /> PHP: Then in viewimage.php, you do something like: $name = $_GET['name']; if(basename($name) != $name){ die('Invalid File.');} header('Content-type: image/jpeg'); ob_clean(); flush(); readfile('/home/username/public_html/admin/uploads/'.$name); exit(); PHP: Just make sure that $path only contains the image name (no folders).
Ok i've used the above code from ThePHPMaster but it gives me this error: warning readfile(/home/username/admin/uploads/)[function.readfile]: failed to open: No such file or directory in c:\....\index.php. This is frustrating for me guys.
Not sure if you fixed it already, just saw this post on my profile page, sorry. It seems that you are not passing the image correctly. Are you sure you are accessing the page this way: <img src="viewimage.php?name=$path" /> PHP: