Jump to content

Uploading files


gordon.c

Recommended Posts

Hi,

 

I have got a problem with uploading files... This is the code I use for it

 

<?php 
$target = "http://localhost/virtualstorage/data/"; 
$target = $target.basename($_FILES['uploaded']['name']);
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 
{
echo "<p>The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
} 
else 
{
echo "<p>Sorry, there was a problem uploading your file.";
}
?> 

 

The return error follows:

Warning: Unable to create 'http://localhost/virtualstorage/data/*.txt': Invalid argument in c:\apache\htdocs\virtualstorage\admin\addfile.php on line 54

 

Warning: Unable to move 'C:\WINDOWS\phpB2.tmp' to 'http://localhost/virtualstorage/data/*.txt' in c:\apache\htdocs\virtualstorage\admin\addfile.php on line 54

 

* - file name

Strange is that many pages agree with this code but it fails, do you know why?

Link to comment
https://forums.phpfreaks.com/topic/76087-uploading-files/
Share on other sites

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.