We have PHP code on a server that receives files into $_FILE and then stores them based on user/security considerations.
On the client, we can currently send the file to the server as-is or we would like to process the file locally (in memory in js in the browser) and then deliver the file to the server. We can POST the processed file to the server using JSON, however there are issues with that.
We would much prefer to send the contents of the client's javascript variable to the server to be received in $_FILE. (We cannot assume client will have the ability to save the file locally.) Do we have to imitate a FORM submission somehow?
How to we send a javascript variable to be received as a PHP $_FILE?
Thanks!
UPDATE Blob definitely appears to be the right direction, but we are noticing that the Blob size is coming out 50% larger than the file that goes in to it. The file in $_FILE is also 50% larger. We have tried overriding the file type at Blob creation, based on other posts such as BlobBuilder ruins binary data, however it hasn't fixed the 50% increase in size. We are setting the Blob file type based on the drag and drop file type we receive. For example, we upload a 900K PDF file. Type was something like 'application/pdf'. The resultant blob was like 1,400K. Also tried with PNG.