<?php
if ($_FILES["myfile"]["error"] > 0)
{
echo "Error: " . $_FILES["myfile"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["myfile"]["name"] . "<br />";
echo "Type: " . $_FILES["myfile"]["type"] . "<br />";
echo "Size: " . ($_FILES["myfile"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["myfile"]["tmp_name"];
$targetpath = 'tmpimage/'.$_FILES["myfile"]["name"];
if(move_uploaded_file($_FILES['myfile']['name'], $target_path)) {
echo "The file ". basename( $_FILES['myfile']['name']). " has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
}
?>
2 replies to this topic
#1
Posted 13 January 2011 - 09:27 AM
I'm trying to upload a file using fileupload but the tmp_name for that file doesn't exist.. the tmp_name is C:\xampp\tmp\php154E.tmp what am I doing wrong? I followed the instructions from tizag and w3schools and here's my code so far:
|
|
|
#2
Posted 13 January 2011 - 04:10 PM
1) does C:\xampp\tmp\ exist?
2) what are the permissions on that folder set to?
Sometimes the issue isn't with the code.
2) what are the permissions on that folder set to?
Sometimes the issue isn't with the code.
#3
Posted 17 January 2011 - 12:30 PM
Check that the directory "tmpimage" is in the same directory where the script is running. Hope it helps you.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









