# Php: getting no where with upload

**URL:** <https://forum.kirupa.com/t/php-getting-no-where-with-upload/177155>\
**Category:** Uncategorized\
**Created:** [January 30, 2006, 6:44pm UTC](https://forum.kirupa.com/t/php-getting-no-where-with-upload/177155 "2006-01-30T18:44:17Z")\
**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 30, 2006, 6:44pm UTC](https://forum.kirupa.com/t/php-getting-no-where-with-upload/177155/1 "2006-01-30T18:44:17Z")

</div>

Ok, I need to be able to let my client upload images to the server. this is my code…

```php
//$idir = "D:/Clients/14372/freaksheep.net/freaksheep.net/pratt/images/"; //I've tried absolute and reletive
  $idir = "images/"; // Path To Images Directory

$file_ext = strrchr($_FILES["image"]["name"], ".");
  $url = $imageid."".$file_ext; // Set $url To Equal The Filename For Later Use
  if($_FILES["image"]["type"] == "image/jpg" || $_FILES["image"]["type"] == "image/jpeg" || $_FILES["image"]["type"] == "image/pjpeg"){
    if(is_uploaded_file($_FILES["image"]["tmp_name"])){
    if($copy = move_uploaded_file($_FILES["image"]["tmp_name"], $idir.$url)){
      echo "Image uploaded successfully.<br />";
      
    } else {
      echo "<font color=\"#FF0000\">ERROR: ".$_FILES["image"]["error"]."</font><br />";
    }
  }else{
  echo "Error!";
  }
  } else {
    echo "<font color=\"#FF0000\">ERROR: Wrong filetype (has to be a .jpg or .jpeg. Yours is $file_ext.</font>";
  }

```

I keep getting ‘ERROR: 0’ as the output.

really confused ☹

\_naaman
