Conversion to base64 with php
<p>I'm converting an image upload to base64, but I'm also trying to not have to store the image on my server unfortunately this code stores the file on my server is there a way to have it delete the file after it it encoded to base64?</p>

<p>Here is my code..</p>

<pre><code>    if(isset($_FILES['t1']['name'])){
    $file = rand(0, 10000000).$_FILES['t1']['name'];
    if (move_uploaded_file($_FILES['t1']['tmp_name'], $file)) {
        if($fp = fopen($file,"rb", 0))
        {
           $picture = fread($fp,filesize($file));
           fclose($fp);
           // base64 encode the binary data, then break it
           // into chunks according to RFC 2045 semantics
           $base64 = base64_encode($picture);
           $tag1 = '&lt;img src="data:image/png;base64,'.$base64.'" alt="" /&gt;';
           $css = 'url(data:image/png;base64,'.str_replace("\n", "", $base64).'); ';
        }
    }
}
</code></pre>
