php - Copy image from URL to Web Server File System -


trying build form uploading images via url , have copied there server.

searching follwoing threads:

i've tried this:

$pic = submitted image url $pic = submitted image name . ".jpg"  copy($pic, $_server['document_root'] . '/mydir/' . $picname); 

results in:

warning: copy(mydir/mypic.jpg) [function.copy]: failed open stream: no such file or directory in /home/user/public_html/mysite.ca/upload.php on line 42

this:

$fp = fopen($_server['document_root'] . '/mydir/' . $picname, "w"); fwrite($fp, $pic); fclose($fp); 

results in:

warning: fwrite() expects parameter 1 resource, boolean given in /home/user/public_html/mysite.ca/upload.php on line 47

warning: fclose() expects parameter 1 resource, boolean given in /home/user/public_html/mysite.ca/upload.php on line 48

directory permissions 777, no personal info anywhere on server. there no error in of logs, i'm not sure how troubleshoot this?

directly opening urls files works if server has allow_url_fopen option enabled.

fopen() failing , returning false not checking that. there wrong filename or directory permissions.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -