This topic is 4711 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hey everyone, I was wondering if anyone knew a way to copy over a picture from the local space to the server space thorugh a function. Thanks in advance, -sathenzar.

Share on other sites

Try this on for size.

Share on other sites
I've seen that and amazingly enough I dont' really understand how to set it up, which is sad b/c I've been programming PHP for over a year now, I should be able to do somthing as simple as this. Could someone build me a quick example if it wouldn't be to much to ask? Thanks in advance.

Share on other sites
well I tried it myself and I got these errors:
/blogs/beach.jpg
Warning: move_uploaded_file(/blogs/beach.jpg): failed to open stream: No such file or directory in /home/demon/public_html/blogs/test.php on line 12

Warning: move_uploaded_file(): Unable to move '/tmp/phpy5dvzu' to '/blogs/beach.jpg' in /home/demon/public_html/blogs/test.php on line 12
Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => beach.jpg
[type] => image/pjpeg
[tmp_name] => /tmp/phpy5dvzu
[error] => 0
[size] => 28111
)

)

my code is here:

Share on other sites
now I get:
Warning: Wrong parameter count for realpath() in /home/demon/public_html/blogs/test.php on line 8

/blogs/beach.jpg
Warning: copy(/blogs/beach.jpg): failed to open stream: No such file or directory in /home/demon/public_html/blogs/test.php on line 12

Share on other sites
Oops. That should have been
$uploadfile = realpath ("./") . "/blogs/" .$_FILES["userfile"]["name"] ;

Share on other sites
ok that works, thank you.