is it possible to set the contents (data) of a fil

2019-04-14 09:09发布

i am using html5 canvas to alter an image. i would like to be able to use the resulting canvas image data to send to the server using the same file upload field. (alternately, it could be by adding a new field to the existing form).

i have converted the image to a Blob, but it seems that the only way to send this type of data to the server is using FormData, which requires its own (separate) XMLHttpRequest. this is not desirable for me.

(context: i am trying to essentially hijack any arbitrary file input field in any arbitrary form on a page. consequently, i do not want to alter the method the form is submitted and i would also like to avoid changing anything on the server side as well. basically, i think the only way to do this would be to re-use or replace the file field. probably not possible, but i thought i would ask.)

0条回答
登录 后发表回答