Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't upload file in AppSmith #1332

Open
tengfei86 opened this issue Aug 29, 2024 · 2 comments
Open

Can't upload file in AppSmith #1332

tengfei86 opened this issue Aug 29, 2024 · 2 comments

Comments

@tengfei86
Copy link

  • 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
Copy link
Author

Any update ?

@YunZZY
Copy link
Collaborator

YunZZY commented Sep 14, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@tengfei86 @YunZZY and others