base64 でエンコードされた文字列を取得して、「参照」機能から選択したファイルであるかのように模倣できるようにしたいと考えています。以下に短い例を示します。
<input type="file" id="file" />
<script>
//I want to be able to access it here
$("#file").files;
</script>
files 配列にアクセスして、通常のファイルとして使用できるようにしたいです。現在、次のように base64 でエンコードされた文字列を取得しています。
// resize the canvas and draw the image data into it
var canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, width, height);
preview.appendChild(canvas); // do the actual resized preview
var base64String = canvas.toDataURL("image/jpeg", 0.7);