Upload jpeg not working, but php echo says it is

hi guys, hope u can help me out on this one
i am trying to use this technique to upload jpeg files to a server

whenever i upload something, the echos tell me the file name and size and type and where it was stored in, but when i check the folder there is nothing there

Show us the HTML form as well as the PHP script/code that you have.

The script works. You are sending jpg or gif images with maximum size of 20k?

Upload.html:

<html>
<body>

<form action=“upload_file.php” method=“post”
enctype=“multipart/form-data”>
<label for=“file”>Filename:</label>
<input type=“file” name=“file” id=“file” />
<br />
<input type=“submit” name=“submit” value=“Submit” />
</form>

</body>
</html>

upload_file.php:

<?php
if ((($_FILES[“file”][“type”] == “image/gif”)
|| ($_FILES[“file”][“type”] == “image/jpeg”)
|| ($_FILES[“file”][“type”] == “image/pjpeg”))
&& ($_FILES[“file”][“size”] < 20000))
{
if ($_FILES[“file”][“error”] > 0)
{
echo "Return Code: " . $_FILES[“file”][“error”] . “<br />”;
}
else
{
echo "Upload: " . $_FILES[“file”][“name”] . “<br />”;
echo "Type: " . $_FILES[“file”][“type”] . “<br />”;
echo “Size: " . ($_FILES[“file”][“size”] / 1024) . " Kb<br />”;
echo "Temp file: " . $_FILES[“file”][“tmp_name”] . “<br />”;

if (file_exists("upload/" . $_FILES["file"]["name"]))
  {
  echo $_FILES["file"]["name"] . " already exists. ";
  }
else
  {
  move_uploaded_file($_FILES["file"]["tmp_name"],
  "upload/" . $_FILES["file"]["name"]);
  echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
  }
}

}
else

Remember to set permission (chmod) in upload folder.

As Raju says what code are you using; if you read the page you linked to the first example just saves a tempory image. You need to use the last example which save the image for you to use.

The example on the w3schools site works fine :slight_smile:

If your code isn’t working properly then you haven’t followed the w3schools example correctly. Post your code so we can see what you have done.