I am trying to copy an image from http://i.imgur.com/avcsLXI.jpg to localhost. It gives me a
Warning:
copy(http://i.imgur.com/avcsLXI.jpg)
[function.copy]: failed to open stream: Permission denied in/var/www/html/test/timg
The folder timg
has got 777 access
copy("http://i.imgur.com/avcsLXI.jpg","timg/avcsLXI.jpg");
move_uploaded_file()
throws the same error
I have seen various examples but not seen one with copy. I do not want to use fopen or curl for this purpose.
You need to specify the desitination filename, not just the directory.
This works for me:
copy("http://i.imgur.com/avcsLXI.jpg","timg/avcsLXI.jpg");
Note that some webhosts don't allow URLs as the source path for security reasons, this will only work if "fopen wrappers" have been enabled.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments