tags:

views:

31

answers:

1

I am executing the following commands:

<?php
copy ("http://localhost/.../DSCF8253.JPG" , "sites/default/files/DSCF8253.JPG"); // Success!
copy ("http://localhost/.../DSCF8260.JPG" , "sites/default/files/DSCF8260.JPG"); // Success!
copy ("http://localhost/.../HERMAN 085.jpg" , "sites/default/files/HERMAN 085.jpg" ); // Fail!
?>

The first two copy fine, but not the last one. Why?

It must have something to do with the filenames (the last one has a SPACE before the 085).

Any help would be greatly appreciated!

+2  A: 
http://localhost/.../HERMAN 085.jpg

Should be

http://localhost/.../HERMAN%20085.jpg

Copy & the http wrappers are less forgiving then browsers / user-agents when it comes to invalid urls. A space in an url is invalid, so it should be urlencode'd.

Wrikken
Still doesn't work, but ur definitely on the right path. I used urlencode with no luck. Any other suggestions?
RD
Wrikken
CURL ended up being the best solution.
RD