title: Facebook - cannot upload file using the <input type="file"> tag
body: <p>I am trying to let the user upload an image from my facebook app using the following php</p>
  
  <pre><code>&lt;?php
  echo render_header('Your');
  
  define("MAX_SIZE", "1536");
  
  function getExtension($str){
    $i = strpos($str,".");
    if(!$i) {return "";}
    $l = strlen($str) - $i;
    $ext = substr($str, $i+1, $l);
    return $ext;
  }
  
  $errors = 0;
  
  if(isset($_POST['Upload'])){
    $image = $_FILES["file1"]["name"];
    if($image){
      $filename = stripslashes($_FILES["file1"]["name"]);
      $extension = getExtension($filename);
      $extension = strtolower($extension);
      if((strcasecmp($extension,"jpg") != 0) &amp;&amp; (strcasecmp($extension,"jpeg") != 0) &amp;&amp; (strcasecmp($extension,"png") != 0) &amp;&amp; (strcasecmp($extension,"gif") != 0))
      {
        $errors = 1; 
      }
      else{
        $size = filesize($_FILES['file1']['tmp_name']);
        if($size &gt; MAX_SIZE*1024){
          $errors = 2;
        }
        else{
          $image_name = md5(uniqid()) . '.' . $extension;
          $newname = "../images/" . $image_name;
          $flName = "/images/" . $image_name;
          $copied = move_uploaded_file($_FILES['file1']['tmp_name'], $newname);
          if(!$copied){
            $errors = 3;
          }
        }
      }
    }
  }
  
  if(isset($_POST['Upload']) &amp;&amp; $errors == 0){
    //add to database here
    ...
    if($errors == 0){
      include "uploadedFile.php";
    }
  }
  else{
  
  $user_details = $fb-&gt;api_client-&gt;users_getInfo($user, 'first_name,last_name,pic_square');
  $image_url = $user_details[0]['pic_square'];
  if($image_url == ""){
    $image_url = "http://static.ak.fbcdn.net/pics/q_silhouette.gif";
  }
  $user_name = $user_details[0]['first_name'] . " " . $user_details[0]['last_name'];
  if(isset($_POST['Upload']) &amp;&amp; $errors == 0){
  ?&gt;
  &lt;div id="error" class="error"&gt;
  &lt;h2 id="standard_error" name="standard_error"&gt;Failed to upload tattoo.&lt;/h2&gt;
  &lt;p id="standard_explanation" name="standard_explanation"&gt;
  Error uploading file. This error occurred because either the photo was a size we don't support or there was a problem with the image file.
  &lt;br/&gt;
  &lt;/p&gt;
  &lt;/div&gt;
  &lt;?php 
  }
  ?&gt;
  &lt;div id="newalbum" align="center"&gt;
  &lt;form id="upload" enctype="multipart/form-data" name="upload" action="" method="post"&gt;
  &lt;table class="formtable" cellspacing="0" border="0"&gt;
  &lt;tbody&gt;
  &lt;tr class="tallrow"&gt;
  &lt;td class="label"&gt;
  Upload Image:
  &lt;br/&gt;
  &lt;small&gt;
  You can upload
  &lt;br/&gt;
  JPG, GIF or PNG
  &lt;br/&gt;
  files.
  &lt;/small&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;div id="files"&gt;
  &lt;div id="1"&gt;
  &lt;input id="file1" class="inputfile" type="file" name="file1" size="22"/&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;div class="formbuttons"&gt;
  &lt;input id="" class="inputbutton" type="submit" value="Upload Tattoo" name="Upload" /&gt;
  &lt;br/&gt;
  &lt;small&gt;The file size limit 1.5 MB. If your upload does not work, try uploading a smaller picture.&lt;/small&gt;
  &lt;br/&gt;
  &lt;/div&gt;
  &lt;?php
  }
  ?&gt;
  </code></pre>
  
  <p>But when I execute this code and the user presses the "Upload" button, the value of $_FILES['file1']['name'] comes out to be blank.</p>
  
  <p>Is this code permissible in Facebook apps? If not what is the correct way to upload files?</p>
  
  <p>Thanks</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Ok so the problem is with facebook. They strip out all file tags from any request! It is suggested that we use iframes instead!</p>
  
  <p>Thanks for the help everyone!</p>