Reputation: 19
i am going to use a simple php script to upload images to the specified folder but i got this error after sending file:
Warning: move_uploaded_file(): Unable to move '/tmp/phpbY8z4A' to 'http://www.yapi-dekorasyon.net/images/Exactly-Sport-According-to-Zodiac.jpg' in /home/pyapitj2/public_html/upload/upload.php on line 8
Upload failed
Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => Exactly-Sport-According-to-Zodiac.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpbY8z4A
[error] => 0
[size] => 119217
)
)
index.php;
<form enctype="multipart/form-data" action="upload.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="512000" />
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
upload.php;
$uploaddir = 'http://www.yapi-dekorasyon.net/images/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo "<p>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Upload failed";
}
echo "</p>";
echo '<pre>';
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
As i tried many other scripts for uploading files to the site i got similar errors. How to solve this problem?
Thanks...
Upvotes: 0
Views: 56
Reputation: 197
You are attempting to upload the file to a URL folder, instead of a Path such as /var/www/vhosts/domain.com/httpdocs/uploads/
Upvotes: 1