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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.