我尝试使用签名网址将文件上传到我的 Google Cloud Storage。
如何防止上传空文件?
我没有在 GCS 文档中看到,也没有在 stackoverflow 上看到有什么问题
function ajaxSendToStorage(url, file, row){
$.ajax({
method: 'PUT',
dataType: "xml",
contentType: file.type,
crossDomain: true,
data: file,
url: url,
beforeSend: function (request){
request.setRequestHeader("Content-Type", 'multipart/formdata; charset=UTF-8');
},
success: function(data) {
storageLoadComplete(row)
},
complete: function() {
// do something when complete
},
});
}
Run Code Online (Sandbox Code Playgroud)
...这是我在控制台日志中得到的内容: