ali-oss icon indicating copy to clipboard operation
ali-oss copied to clipboard

Can't upload file in AppSmith

Open tengfei86 opened this issue 1 year ago • 2 comments

  • Browser Version:
  • ali-oss 6.18:
  • Mini Showcase Repository:
  • Network Resoponse Header x-oss-request-id:
  
		try {
			// 获取上传的文件
			const file = FilePicker.files[0];
			const options = {
				meta: { temp: "demo" },
				mime: "json",
				headers: { "Content-Type": "text/plain" },
			};
			// const blob = new Blob([bytes],{type: fileType});
			var data = new Blob(['This is the sample data']);
			// 将文件上传到阿里云OSS
			const result = await client.put("debug.txt", data,options);
			console.log("=========");
			console.log(result);
			// 显示上传成功的消息
			showAlert('上传成功', 'success');

			// 获取上传后的文件URL
			const uploadedFileUrl = result.url;
			console.log("Uploaded File URL:", uploadedFileUrl);

			// 将上传的文件URL保存到变量
			myvar1 = uploadedFileUrl;

			// 返回文件URL,或者在需要的地方使用这个变量
			return myvar1;

		} catch (e) {
			// 显示上传失败的消息
			console.log("caceh" + e);
			showAlert('上传失败: ' + e.message, 'error');
		}

this log file is as below ,you can refer 47.94.208.160-1724898269844.log

tengfei86 avatar Aug 29 '24 03:08 tengfei86

Any update ?

tengfei86 avatar Aug 29 '24 14:08 tengfei86

The provided code snippet does not reveal any apparent issues. However, based on the log information, the following problems may exist:

  1. The usage of the "Expect" request header
  2. The usage of Webworker, but this SDK does not support Webworker at present

If it is not due to the above reasons, please provide a minimal reproducible repository and steps to reproduce it so that we can check it out.

YunZZY avatar Sep 14 '24 10:09 YunZZY