Jump to content

move_uploaded_file Error


Recommended Posts

I have been trying to upload videos using the move_uploaded_file function but have come up with a new error which is displayed below.

 

Warning: move_uploaded_file(/home/~unn_s003539/public_html/Sold/uploadsPC45 close up .jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /var/www/vhosts/numyspace.co.uk/web_users/home/~unn_s003539/public_html/Sold/vidupload.php on line 25

 

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpUWYU51' to '/home/~unn_s003539/public_html/Sold/uploadsPC45 close up .jpg' in /var/www/vhosts/numyspace.co.uk/web_users/home/~unn_s003539/public_html/Sold/vidupload.php on line 25

Error when uploading the video./var/www/vhosts/numyspace.co.uk/httpdocs

 

I don't understand why this error is occuring as the file target I'm using is exactly the same as the one in the ftp file which I have just copied across. My code looks like this:

 

session_start();

 

      include("connection.php");

      $target = "/home/~unn_s003539/public_html/Sold/uploads";

 

$target = $target . basename( $_FILES['video']['name']);

 

$name=$_POST['name'];

$email=$_POST['email'];

$title=$_POST['title'];

$description = $_POST['description'];

$pic=($_FILES['video']['name']);

 

 

$sql="INSERT INTO `videos` (name, date, email, title, description, video)

VALUES ('$name','CURDATE()', '$email', '$title', '$description','$pic')" ;

 

$result=mysql_query($sql);

 

 

 

if(move_uploaded_file($_FILES['video']['tmp_name'], $target)) {

 

echo "Successful upload of ". basename( $_FILES['video']['name']);

 

} else{

 

echo "Error when uploading the video.";

 

}.

 

Any Help would be greatly appreciated.

 

Link to comment
https://forums.phpfreaks.com/topic/220811-move_uploaded_file-error/
Share on other sites

Your path clearly is not correct.

 

Your full path is (gotten from the part of the error message where your page is at) -

 

/var/www/vhosts/numyspace.co.uk/web_users/home/~unn_s003539/public_html/Sold/vidupload.php

 

You are tying to use the following destination -

 

/home/~unn_s003539/public_html/Sold/uploadsPC45 close up .jpg

 

You are missing /var/www/vhosts/numyspace.co.uk/web_users from the front of the absolute file system path you are trying to make OR you would need to remove all of that and make it a relative path from where your vidupload.php is located.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.