tomjung09 0 Posted April 30, 2009 Share Posted April 30, 2009 I'm trying to do a simple upload from client computer to a directory on my server. I have checked the folder settings and it is chmod 777. This is my code: $path = $date . $x .".". "jpg"; $image2[$x] = $path; if ($_FILES["txtimage1"]["error"] > 0) { echo "Error: " . $_FILES["txtimage1"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["txtimage1"]["name"] . "<br />"; echo "Type: " . $_FILES["txtimage1"]["type"] . "<br />"; echo "Size: " . ($_FILES["txtimage1"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["txtimage1"]["tmp_name"]; } if(copy($_FILES['uploadedfile']['tmp_name'], $path)){echo "uploaded \n";} It outputs: Upload: 13332118_1X.JPG Type: image/jpeg Size: 88.9501953125 Kb Stored in: c:\winnt\temp\php4\php1190.tmp success I have tried setting the path to <filename> .jpg and .jpeg neither works, I am to the point where I am just trying to get it to upload to the directory that the php file resides in. The file txtimage1 is being called from contains the form and file form: <form id="form1" name="form1" method="post" action="uploadbikesubmit.php" enctype="multipart/form-data"> <input type="file" name="txtimage1"/> Any ideas on what might be causing the problem or things I might try? I have also tried the move_uploaded_file() function, no luck there either. Link to post Share on other sites
tomjung09 0 Posted April 30, 2009 Author Share Posted April 30, 2009 So...I had the wrong name for the copy($_FILES['uploadedfile']['tmp_name'], $path) it should have been copy($_FILES['txtimage1']['tmp_name'], $path) I'm a little perplexed as to why copy() works but move_uploaded_file() does not. At any rate, I suppose I spent 5 hours looking for something right in front of me.... I've been at this too long. Link to post Share on other sites
Recommended Posts
Archived
This topic is now archived and is closed to further replies.