/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] warning: move_uploaded_file issue

I’m a noob in PHP.

After doing a lot of reading on this forum and other articles, I’ve created an upload form and use a php file to process it and do different things with different elements.

One of them is uploading a file.

[CODE]//Upload files
$uploaddir = ‘http://www.websitename.com/artworks/’;
$uploadfile = $uploaddir.$_FILES[‘req_artwork’][‘name’];
$userfile = $_FILES[‘req_artwork’][‘name’];
$tmp_name = $_FILES[‘req_artwork’][‘tmp_name’];[/CODE]

After submitting the form, I get the following error message:

[COLOR=”red”]Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/tmp/phpRBNnTq’ to ‘http://www.yourwebsite.com/artworks/img20080112141901.jpg‘ in php on line 33[/COLOR]

I’ve looked at line 33 in my PHP script and all that’s there is

[CODE]if (move_uploaded_file($_FILES[‘req_artwork’][‘tmp_name’],’http://www.websitename.com/folder/’)) {
print (‘Your file has been uploaded.’);
}
else {
print (‘There was a problem with the upload of your artwork. Please e-mail your artwork directly to [email protected].’);
}[/CODE]

My hosting server is running PHP 5.2.5.

I’ve been trying to read up and find out what could ’cause this, but no luck.

Can someone guide me or let me know what could cause this problem?

Thank you in advance.

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@scragarJan 26.2009 — What? Why do you have a URL in your move path? It should be a file path.
Copy linkTweet thisAlerts:
@bootnoob2k8authorJan 26.2009 — I've read on some article on the internet that in PHP5 for move_uploaded_file destination has to be absolute path to the folder...at first, i had a relative one, but then it was giving me another error, when i switched it over to an absolute one, that one error disappeared, but then the one i posted above is still there.
Copy linkTweet thisAlerts:
@Mr__E__CrypticJan 26.2009 — Have you tried an internal file path?, eg:

/home/userName/www/folderName/
Copy linkTweet thisAlerts:
@bootnoob2k8authorJan 27.2009 — i just took out one of the / and left it at folder name for $uploaddir and now it works...after it runs if else statement, it returns that "File has been uploaded", but when I go into the folder, nothing is there ?:eek:?

now i'm really confused.
×

Success!

Help @bootnoob2k8 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...