# Php upload

**URL:** <https://forum.kirupa.com/t/php-upload/176584>\
**Category:** Uncategorized\
**Created:** [January 25, 2006, 6:38am UTC](https://forum.kirupa.com/t/php-upload/176584 "2006-01-25T06:38:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FreakSheep](https://avatars.discourse-cdn.com/v4/letter/f/d9b06d/32.png) [@FreakSheep](https://forum.kirupa.com/u/FreakSheep)\
**Post date:** [January 25, 2006, 6:38am UTC](https://forum.kirupa.com/t/php-upload/176584/1 "2006-01-25T06:38:41Z")

</div>

Ok, so i’m uploading with php for my first time… easier then asp, but im still running into a problem

this is my code…

```php
$idir = "../images/";
$tdir = "../images/thumbs/";
$twidth = "125"; 
$theight = "100"; 
$file_ext = strrchr($_FILES["image"]["name"], ".");
  $url = $imageid."".$file_ext;
  if($_FILES["image"]["type"] == "image/jpg" || $_FILES["image"]["type"] == "image/jpeg" || $_FILES["image"]["type"] == "image/pjpeg"){
    $copy = move_uploaded_file($_FILES["image"]["tmp_name"], "$idir".$url);
    if ($copy){
      echo "Image uploaded successfully.<br />";
    } else {
      echo "<font color=\"#FF0000\">ERROR: Unable to upload image.</font>";
    }
  } else {
    echo "<font color=\"#FF0000\">ERROR: Wrong filetype (has to be a .jpg or .jpeg. Yours is $file_ext.</font>";
  }

```

i keep getting the “ERROR: Unable to upload image.” error ☹

anyone?

\_naaman
