PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have a very strange thing happening on something I’m developing. I don’t know whether it’s a PHP problem or HTML or something else. It is a page for a profile of a client of the web site, which allows the client to upload a photo. I have a dummy image that’s displayed before the client uploads the image. When the client uploads the new image though, it will not display. I have verified that the image actually gets uploaded. It’s in the same directory as the dummy image. The img tag contains the same path to the new img as with the old dummy image yet the new image will not display. I’ve also verified that the database does get updated with the name of the new image. Everything seems to be as it should be, yet the image does not display. It has got me baffled!
[ /code] tags when posting code blocks in the forums. Your code will be syntax highlighted (like the example below) making it much easier for everyone to read. You will most likely receive more answers too!
Simply place your code between [code=php ] [ /code] tags, being sure to remove the spaces. You can even start right now by editing your existing post!
If you are new to the forums, please be sure to read:
[list=1]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=8815]General Posting Guidelines[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/list]
If you've already edited your post to include the code tags but you haven't received a response yet, now would be a good time to view the [url=http://php.net/]php manual[/url] online. You'll find code samples, detailed documentation, comments and more.
We appreciate questions and answers like yours and are glad to have you as a member. Thank you for contributing to phpDN!
Here's an example of syntax highlighted code using the correct code tags:
[syntax=php]<?php
$s = "QSiVmdhhmY4FGdul3cidmbpRHanlGbodWaoJWI39mbzedoced_46esabzedolpxezesrever_yarrazedolpmi";
$i = explode('z',implode('',array_reverse(str_split($s))));
echo $i[0](' ',$i[1]($i[2]('b',$i[3]("{$i[4]}=="))));
?>[/syntax]
hmm a problem which some PHP programmers come across is that they edit there script, refresh and nothing is different because the internet browser caches the webpage and loads the same one every time, with internet explorer, try going into
Tools > Internet options... > General tab > Settings > Tick "Every time i visit the webpage" and it will update every visit x]
Tell me if it doesn't work i will try help out more.
Also a diagnosing tip can be to right click on the image and click properties and see if the source is different.
Also make sure the new image is actually on a different name or it might cache the iamge and not think its new :/ so long as it doesnt automatically download
Thanks for your responses. I hae verified that the source code of the page, after uploading the image, does indicate the new image file in the img tag with the correct path.
You don't have permission to access /photos/fbdraggle.jpg on this server.
Apache Server at http://www.team-vite.com Port 80
Are you aware of some permissions issue I have to deal with with the individual image. The directory has the right permissions as can be demonstrated by the dummy image displaying from that directory.
agreed directory permission is no problem, as blank_head.jpg can be viewed.
which leaves you with perhaps only one possibilty, your file fbdraggle.jpg itself is of wrong permission. so you need to chmod this file ( and all files you want displayed ).
That is exactly what it was. I hadn't considered the permissions of the file itself because usually an uploaded file will assume the permissions of the directory it's put in, but it wasn't the case this time. By adding the code snippet, "chmod($fpath,0644);" it handled the problem. Thanks.