Click to See Complete Forum and Search --> : PHP glitch found?
Fafmaschine
01-01-2006, 07:18 PM
I wrote php code to upload jpg image to server which then creates thumbnails of those uploaded images. Everything works perfect. And then I figured out that the thumbnails cannot be altered e.g. renamed, deleted, copied, while the original uploaded images can.
Anybody seen that weird stuff already? :confused: what could be wrong? Thanx!
chazzy
01-01-2006, 07:58 PM
sounds like a bug in your script, not in php.
don't forget, if you're using a webhost w/ shared environment, the images will be owned by the php user. you can change it so that they chown to another user.
SpectreReturns
01-01-2006, 09:09 PM
PHP doesn't have bugs like that. PHP has bugs like certain functions not acting propperly or wrong math or something. This is mearly a problem of bad logic (after uploading, always chmod("file.ext", 0755);).
Fafmaschine
01-02-2006, 03:31 AM
Check out the image:image (http://www.moj-album.com/slike/4849/HXdW4lJn_HhDRGX6.jpg)
Still doesn't work! As you can see all the files are in the folder created by me and that folder has permission set to 777.
uploadimage.php uploads milko.jpg from my home PC to that folder on remote server.
I can do whatever I want with milko.jpg, but with thumb_milko.jpg I always get Warning: rename(thumbnail_milko.jpg,file2.jpg): No such file or directory in uploads/uploadimage.php on line 43
Neither I can chmod thumb_milko.jpg from 644 to 777...
The fact that I chmod uploaded milko.jpg or not doesn't change anything either. :(
bokeh
01-02-2006, 04:04 AM
Why doesn't your script create it with the correct filename in the first place?
chazzy
01-02-2006, 10:57 AM
Check out the image:image (http://www.moj-album.com/slike/4849/HXdW4lJn_HhDRGX6.jpg)
Still doesn't work! As you can see all the files are in the folder created by me and that folder has permission set to 777.
uploadimage.php uploads milko.jpg from my home PC to that folder on remote server.
I can do whatever I want with milko.jpg, but with thumb_milko.jpg I always get Warning: rename(thumbnail_milko.jpg,file2.jpg): No such file or directory in uploads/uploadimage.php on line 43
Neither I can chmod thumb_milko.jpg from 644 to 777...
The fact that I chmod uploaded milko.jpg or not doesn't change anything either. :(
It's owned by apache. That's why you can't change it. When you call rename, the parameters should have quotes around them, try it again like that.
Fafmaschine
01-02-2006, 01:39 PM
I call it like that:
rename('thumbnail_milko.jpg', 'file2.jpg'); and I get warning
or
rename("thumbnail_milko.jpg", "file2.jpg"); I also get the warning.
With originally uploaded file milko.jpg both upper codes work just fine...
chazzy
01-02-2006, 03:31 PM
Hmmm..
are you able to chmod it from the script? Or did you try that already? what about the chgroup command?
Fafmaschine
01-02-2006, 08:00 PM
No ch-thing works...
chazzy
01-02-2006, 10:34 PM
the only thing I can think of right now is that your webhost has some kind of advanced configuration, where the PHP user isn't in the apache group, but when it creates things it chgroup's to apache.
I'm a little stumped.
Fafmaschine
01-03-2006, 04:55 AM
Thanx chazzy for your time and help! Got nothing else to do than call my webhost personally, what he has going on on that damn server :mad: !
I'll post up the outcome for you :)
Fafmaschine
01-03-2006, 09:47 AM
It's funny as hell!!
I called my webhost and he said the problem with folders is that they have PHP safe mode on. And as for me he said that maybe I have errors in my PHP code.
But then miraculously after a few hours my "since-then-wrong" PHP code started to work!! :D
Now you can see what small phone call can achieve!!
chazzy
01-03-2006, 01:17 PM
score one for obscure php settings being on.
good luck.
i had a similar experience, having to do with mail, my host required everyone to provide from tags in the headers but didn't tell anyone. i asked them simply where it was stated in their TOS, no response yet.