fileReader.readAsBinaryString to upload files

后端 未结 3 1920
自闭症患者
自闭症患者 2020-11-27 10:54

Trying to use fileReader.readAsBinaryString to upload a PNG file to the server via AJAX, stripped down code (fileObject is the object containing info on my file);

         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 11:07

    Use fileReader.readAsDataURL( fileObject ), this will encode it to base64, which you can safely upload to your server.

提交回复
热议问题