gordon.c Posted November 5, 2007 Share Posted November 5, 2007 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 More sharing options...
Wuhtzu Posted November 5, 2007 Share Posted November 5, 2007 You obviously haven't posted 54 lines or more of code so we can't see what line is 54 and even if you had posted more than 54 lines of code a lot of use wouldn't bother to count. Please tell us what line is 54 Link to comment https://forums.phpfreaks.com/topic/76087-uploading-files/#findComment-385160 Share on other sites More sharing options...
darkfreaks Posted November 5, 2007 Share Posted November 5, 2007 <?php if(move_uploaded_file($_FILES['uploaded']||$_FILES['tmp_name'], $target)) { //do stuff } ?> Link to comment https://forums.phpfreaks.com/topic/76087-uploading-files/#findComment-385163 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.