Closed oppokui closed 1 month ago
@seratch do you know anything I am missing in the .zip upload process?
Hi @oppokui, thanks for asking the question. The following code works for me without any issues:
FilesUploadV2Response response = Slack.getInstance().methods(botToken).filesUploadV2(r -> r
.file(new java.io.File("./test.zip"))
.title("test.zip")
.filename("test.zip")
.channel(channelId)
.initialComment("Here you are :wave:")
);
If your uploaded file is invalid, it could be caused by file access issue or data corruption. I hope you'll figure the cause out soon.
Thanks, @seratch
Is it a bug of uploading multi files?
The following code doesn't work for .zip file (but works for .png file):
FilesUploadV2Request.UploadFile uploadFile = new FilesUploadV2Request.UploadFile();
uploadFile.setFile(file);
uploadFile.setFilename(filename);
uploadFile.setTitle(filename);
uploadFile.setAltTxt(desc);
uploadFiles.add(uploadFile);
FilesUploadV2Request request = FilesUploadV2Request.builder().uploadFiles(uploadFiles)
.token(boltToken).channel(channelId).build();
If I change to upload one file as you show in the example code, it works for .zip:
FilesUploadV2Request request = FilesUploadV2Request.builder().file(file).filename(filename)
.title(filename)
.token(boltToken).channel(channelId).build();
Ah I see. Since it’s Saturday for me, I will check the issue early next week. Thanks for reporting the issue and we’re sorry about the inconvenience.
@seratch , no problem. Happy weekend!
I am in Bolt SDK 1.37.
I want to use client API to upload file like .png and .zip. I can manually upload files in Slack app, so suppose I can do it as well in client API. I find uploading .png file to a channel is simple and works well, but uploading a .zip file won't work. Firstly, I need to send the link to channel message, Secondly, I can't download the zip file (never complete). It sounds the file doesn't upload successfully. I use permal link, not sure it is ok. Any suggestion?
Slack website has many detailed explanations about the upload process, but never have a complete example code.
Here is my code: