这是我的b64toBlob()函数,我将其用于将base64转换为blob,因此我可以通过附加到formData将其上传到服务器:
function b64toBlob(b64Data, contentType, sliceSize) {
contentType = contentType || '';
sliceSize = sliceSize || 512;
var byteCharacters = atob(b64Data);
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
var slice = byteCharacters.slice(offset, offset + sliceSize);
var byteNumbers = new Array(slice.length);
for (var i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
var blob = new Blob(byteArrays, { type: contentType });
return blob;
}
这是我的base64代码:
/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCADIAMgDASIAAhEBAxEB/8QAHQAAAQUBAQEBAAAAAAAAAAAABQADBAYHAggBCf/EAD0QAAEDAwMCBAQFAgQGAgMAAAECAwQABREGEiExQRMiUWEHFDJxFUKBkaEjUgixwfAWJDNi0eE0ciVDU//EABsBAAIDAQEBAAAAAAAAAAAAAAIDAQQFAAYH/8QAMhEAAgEDAwEGBQMFAQEAAAAAAQIAAxEhBBIxQQUTIlFxgWGRsdHwI6HBBjJC4fEUgv/aAAwDAQACEQMRAD8ArVyt0yCtXzsd1khRSStOPMO1aXo+ZOn2CNdb0y2FtOBiM4VBJewPLx/FHJtvF+RKt9zjtvxCSpCl8BOBwQf9aomsrVe71f4NujNpi2VlpLrMmOrLSEpHK8j83YVlajUf+vbSNlNr3BvgjgdbnqJo0qIog1LEi9rEWyDz6DoYKatFyvepJt71La1MIbl+GqKgY8eQeUNp9U9Co9wfetRjqjaStL9zvUkIW2lT0p08AJ7JSPQcAC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Np2dBkCFLRYRa5Pzq5ralBpTTaG04CNxJUc9z5jRSLDESIiJDKQyg5CVDPPrmlSr6/oOw9BoG3UaY3eZyfmf4ng9T2jqtSNtRzby4E68IlZDhBPbFMuqW0r03DjI60qVbFrTPBjalZbyoJPPNRHSFghGSOhpUqkyZEfbWvnkVEIBBIAyOxpUqRUxHLxGRgnPB9qNaYa0o9KcY1PIdih1TaGJGwqZaySFKcAUk8cEdRwcg5pUqpVhuQi9o1ObzfXpOjNL3VNnmPQ7XcFxvnIMZ1aoMFGEbVKbfc8riVKU4RsGCkkc8GhS9cyHjbkuS4FmlMqURZ1Ft633pgHILTytqcHbwVqyD2ycUqVeWSipsxySLzT3EcSkXDRl/nSY2r/AIe2iVY1SI6lOQ3XEsrSoEkbDuwpK0pURuCUnw1Yzim7NreTfXGbVqJ92Pc4zXgsqecSw0rgpwUhIKVbSQc53cDHSlSoltqFdag/t4PWQxKEW6yzvvsxpLaZi/lo0F1TchpTRYDTIQlSvE3DxFANqzkJ24SFcAE0qVKqIpgxwYz/2Q==
但是当我运行它时,它只返回没有图像数据的Blob(15598) {size: 15598, type: "image/jpeg"}
。
----更新:我确定这不是关于后端的错误(因为我在其他组件中使用相同的API进行上传)但是,这是我的其余代码:
(我正在使用反应,'那'等于这个)
...
var myDURL = c.toDataURL('image/jpeg')
var base64result = myDURL.split(',')[1];
var theblob = that.b64toBlob(base64result, 'image/jpeg')
var photosformdata = new FormData()
photosformdata.append('files', theblob);
let authUserID = await localStorage.getItem('usrid')
let filesResult = await requester(config.serverurl + 'v1/panel/users/' + await authUserID + '/profile/avatar', 'PUT', true, null, photosformdata, true)
if (filesResult.statusCode == 200 || filesResult.statusCode == 201) {
console.log(filesResult)
this.props.actions.setUploadedFilesOnAddNewMedia(filesResult.data.filesArray)
}
...
这是在下面:(第一个是我得到的,第二个是我必须得到的):qazxsw poi