I have an image uploader on my site...
The image is uploaded to a temporary 777 folder (this image works fine and can be deleted), I then copy this file into a new dir with copy() the new file is written to a 777 folder, but cannot be deleted. chmod() doesn't seem to help...
Why does the copy() function create the new file somehow different to the original file? I can't see any differences in my FTP client. BOTH have perms 644 and user 'nobody/99' - but it's only a problem for the second file.
Any ideas?
You need to manually set the permissions bits yourself: try this.
copy($temp_img_url, $save_file_as); chmod($save_file_as, fileperms($temp_img_url));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With