title: Cannot upload file using PhantomJs (and Selenium WebDriver)
body: <p><strong>What I'm working with:</strong></p>
  
  <p>To start off, my HTML looks the following:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;form action="http://example.com/upload_photo_iframe.html" preview_div="upload_photo_div" submit_button="submit_btn" upload_field="photo_upload" target="photo_target" enctype="multipart/form-data" method="POST" id="uploadfile" name="uploadfile"&gt;
      &lt;input type="hidden" value="CSRF_iframe_photo_upload" name="csrfname"&gt;
      &lt;input type="hidden" value="3350427f0f068509081a09e283607214001b6912843ffb937b934208c91d9041c88faf0e66df4f3898ef202a34b669647f5b3fd9a2122e389acd3f53c33fc88b" name="csrftoken"&gt;
      &lt;label class="file-upload"&gt;
              &lt;p id="upload_text"&gt;Click Browse to choose a file then click Upload&lt;/p&gt;
              &lt;input type="file" class="file" id="photo_upload" name="photo_upload" accept="image/*"&gt;
      &lt;/label&gt;
      &lt;input type="hidden" value="true" name="makeLargeThumb"&gt;
      &lt;input type="hidden" value="p" name="size"&gt;
      &lt;input type="hidden" value="P" name="type"&gt;
      &lt;input type="hidden" value="5120000" name="MAX_FILE_SIZE"&gt;
      &lt;input type="hidden" value="0" name="album_id" class="album_id_hidden"&gt;
      &lt;input type="submit" class="grey_btn" id="upload_btn" value="Upload" name="submit_btn"&gt;
  &lt;input type="hidden" name="callback" value="document.forms.uploadfile.handleReceive"&gt;&lt;input type="hidden" name="fieldName" value="photo_upload"&gt;&lt;/form&gt;
  </code></pre>
  
  <p>I posted the entire thing, the file input is the following part:</p>
  
  <pre><code>&lt;input type="file" class="file" id="photo_upload" name="photo_upload" accept="image/*"&gt;
  </code></pre>
  
  <p><strong>My situation:</strong></p>
  
  <p>I'm using Selenium WebDriver with PhantomJs (C#). 
  Before this I used FireFox instead of PhantomJs and uploaded a file the following way:</p>
  
  <pre><code>_driver.FindElement(photoUploadPath).SendKeys(imagePath);
  </code></pre>
  
  <p><strong>My issue:</strong></p>
  
  <p>However this crashes when I use PhantomJs.</p>
  
  <p><strong>My attempt to solve the issue:</strong></p>
  
  <p>I found the following thread discussing the issue:
  <a href="https://github.com/ariya/phantomjs/issues/10993" rel="nofollow">https://github.com/ariya/phantomjs/issues/10993</a></p>
  
  <p>And I tried the proposed solution:</p>
  
  <pre><code>((PhantomJSDriver)driver).executePhantomJS("var page = this; page.uploadFile('input[type=file]', '/path/to/file');");
  </code></pre>
  
  <p>However, while this doesn't throw an error it doesn't upload the file.</p>
  
  <p>After having searched far and wide my only option is to ask here, hoping someone can help me out. </p>
  
  <p>It seems to me that this is a common problem for many people using PhantomJs+Selenium and it makes me wonder why this bug has yet to be fixed.</p>