Jump to content


This topic is now archived and is closed to further replies.


[SOLVED] Unable to upload files

Recommended Posts

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 />";
  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.



Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites

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