#Bug Report: C# Upload from .net Core 8 - webapi error when file is too big.

13 messages · Page 1 of 1 (latest)

frigid pollen
#

Hi, I'm creating a webapi in .net Core 8 and calling services from AppWrite cloud. I want to expose Upload and Download through the webapi and not directly from the client.

When I try to upload a file that is more larger than 5MB I receive this error.
The error returned is
'The requested route was not found, Please refer to the API docs and try again'

In debug I read the track:
in Appwrite.Client.d311.MoveNext() in Appwrite.Client.d321.MoveNext()
in liveaccounts.api.Repositories.images.AppWriteStorageRepository.d__4.MoveNext() in C:.NET Applications\liveAccounts 2025\liveaccounts.2025.api\Repositories\images\AppWriteStorageRepository.cs: riga 64

It seems apply to Chunks. Need to manage chunks? (in documentation says it's not necessary to do it in sdk.)

Also, when I try to check if file exists, I needed to include the call in a try/catch because thwrow an error if the file doesn't exists,
This is not the expected behaviour.

stiff tapir
#

Hi @frigid pollen
Can you please share what version of Appwrite SDK you've installed in nuget?

#

P.s. it's better to use 3 ` to embed your code

#

As I understand, you have a problem here?

 try
      {
          // Send File to AppWrite
          List<string> perms = new List<string>() { Permission.Write(Role.Any()) };
          Action<UploadProgress> onProgress = null;

        try
        {
            // Check if file already exists
            Appwrite.Models.File exists = await storage.GetFile(storageFile.BucketId, storageFile.FileId);
            if (exists != null)
            {
                // Delete existing File
                await storage.DeleteFile(storageFile.BucketId, storageFile.FileId);
            }
        }
        catch (Exception)
        {
            // Do nothing. I needed to include in try/catch because thwrow an error if the file doesn't exists
        }       

          // Upload new file
          Appwrite.Models.File result = await storage.CreateFile(storageFile.BucketId ,
                           storageFile.FileId,
                           InputFile.FromStream(stream, storageFile.FileName, storageFile.ContentType),
                           perms,
                           onProgress);
          
          storageFile.isUploaded = true;

      }
      catch (AppwriteException ex)
      {
          storageFile.isUploaded = false;
          storageFile.UploadError  = ex.Message;
      }
frigid pollen
stiff tapir
#

I see,

#

Can you check the version for me? so I be able to verify

frigid pollen
#

I use a cloud installation and .net library it's updated at 0.10.0, that it's the latest one.

stiff tapir
#

Thanks

stiff tapir
#

Hi @frigid pollen Thanks to you, we've found the code causing a bug related to multipart. This will be fixed in the next release of the dotnet SDK

I'll keep you posted here, and in the original issue

magic bridge
frigid pollen
#

ok. Thank you

stiff tapir
#

Hi @frigid pollen
The bug was fixed in the latest version of our dotnet SDK.
Update to the latest version, 0.10.1 and let us know