Back

[Bug] Android SDK Storage would not upload files larger than 5 MB if the fileID is not unique

  • 0
  • Android
  • Storage
  • Cloud
Drake
16 Jul, 2023, 19:26

What are the permissions on the bucket and files?

TL;DR
The Android SDK is unable to upload files larger than 5 MB if the fileID is not unique. The issue seems to be with the SDK itself, rather than the server. The user has tried generating the fileID from the timestamp when the file was created, and it works fine for files smaller than 5 MB. However, when trying to upload larger files with a different string instead of the ID, the problem occurs. The user is not intentionally trying to upload files with the same ID. Permissions on the bucket and files are set correctly. Solution: None provided.
Dadang Sudadang
16 Jul, 2023, 19:32

Create files only for any user.

Dadang Sudadang
16 Jul, 2023, 19:33

I tested it and it seems to be the case on cloud console so... yeah not sure then

Dadang Sudadang
16 Jul, 2023, 19:34

Btw, I mean "proper permissions" here as in the application have read and write access to the files inside the Android device itself. Which makes the "file not found" exception to be weirder.

Drake
16 Jul, 2023, 19:39

So are you using the same file id for a file that already exists on the server already?

Dadang Sudadang
16 Jul, 2023, 19:40

Some additional note: the fileID itself isn't the same for every file actually, but rather it was generated from timestamp in my system. I just put a variable in the code snippet to make it simpler

Dadang Sudadang
16 Jul, 2023, 19:41

I tried doing that and it works fine on files smaller than 5 MB.

Dadang Sudadang
16 Jul, 2023, 19:41

It's not my intention to put files with the same ID in the server though

Dadang Sudadang
16 Jul, 2023, 19:42

I wanted to generate the fileID string from the timestamp when the file was created

Dadang Sudadang
16 Jul, 2023, 19:43

However whenever I insert any strings other than ID.Companion.unique() on any file larger than 5 MB, this happens.

Drake
16 Jul, 2023, 19:44

You said there was some loop uploading multiple files...but each file id you're generating is unique and doesn't exist on the server yet, right?

Dadang Sudadang
16 Jul, 2023, 19:44

Yes

Dadang Sudadang
16 Jul, 2023, 19:45

This appears to be more of an issue to the Android SDK itself rather than the server though

Drake
16 Jul, 2023, 19:45

So what are the permissions on the collection and file that gets generated?

Dadang Sudadang
16 Jul, 2023, 19:46

permissions are what I have expected to, yes.

Dadang Sudadang
16 Jul, 2023, 19:46

Bucket: any users can create

Drake
16 Jul, 2023, 19:46

What version of the android SDK are you using?

Dadang Sudadang
16 Jul, 2023, 19:46

2.0.0

Drake
16 Jul, 2023, 19:46

With file security on?

Dadang Sudadang
16 Jul, 2023, 19:46

yes

Dadang Sudadang
16 Jul, 2023, 19:47

only create

Drake
16 Jul, 2023, 19:47

Please share the permissions on the created file

Dadang Sudadang
16 Jul, 2023, 19:48

I apologize but I will have to do it later. It's already 5 am here and I have not slept.

Drake
16 Jul, 2023, 19:51

Also, make sure you're using https for the endpoint.

Dadang Sudadang
16 Jul, 2023, 20:07

Yeah I already use https since I use appwrite cloud

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more