我尝试使用FileUploader将图像上传到我的Express服务器,但是它不起作用。
我已经尝试更改某些参数(sendXHR =“ true”)或使用了tutorial,但是这些选项都不适合我。
我的观点:
<u:FileUploader
id="fileUploader"
name="myFileUpload"
uploadUrl="upload/"
tooltip="Upload your file to the local server"
sendXHR="true"
uploadComplete="handleUploadComplete"/>
<Button
text="Upload File"
press="handleUploadPress"/>
我的控制器:
handleUploadComplete: function (oEvent) {
var sResponse = oEvent.getParameter("response");
if (sResponse) {
var sMsg = oEvent.getParameter("status"); console.log(oEvent.getParameter("status"));
MessageToast.show(sMsg);
}
},
handleUploadPress: function (oEvent) {
var oFileUploader = this.byId("fileUploader");
oFileUploader.upload();
}