Single page temporary PHP file upload
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/166221/how-can-i-upload-files-asynchronously-with-jquery">How can I upload files asynchronously with JQuery?</a>  </p>
</blockquote>



<p>What are the best practices (if any) for allowing a user to select a file and have the contents sent to javaScript(jQuery) in a single page and asynchronously?</p>

<p>HTML:</p>

<pre><code>&lt;form action="" method="post" enctype="multipart/form-data"&gt;
    &lt;input type="file" name="file" id="file" /&gt;
    &lt;input type="submit" name="submit" value="Upload" /&gt;
&lt;/form&gt;
</code></pre>

<p>JS/JQUERY:</p>

<pre><code>$.document.ready(function(){
var txtString = new String(); //set the var to &lt;?php [$_FILE]["file"]["data"] ?&gt;
}
</code></pre>

<p>I'm only using the data to kick off some javaScript so I shouldn't need to move the file out of the temp folder. I'm having a hard time figuring out where to put the PHP to send  the file data to javaScript. Any suggestions would be much appreciated!</p>
