How to give a Blob uploaded as FormData a file name?

后端 未结 8 1544
孤街浪徒
孤街浪徒 2020-11-28 19:59

I am currently uploading images pasted from the clipboard with the following code:

// Turns out getAsFile will return a blob, not a file
var blob = event.cli         


        
8条回答
  •  执笔经年
    2020-11-28 20:50

    For Chrome, Safari and Firefox, just use this:

    form.append("blob", blob, filename);
    

    (see MDN documentation)

提交回复
热议问题