Back

Encountering Function Error When Uploading a Multipart File in FormData with Custom Domain

  • 0
  • Functions
Abhishek
19 Mar, 2024, 19:52

Please refer to the sceenshot

TL;DR
Encountering function error when uploading a multipart file using FormData with a custom domain. The code provided needs to be updated to include handling of multipart files.
Abhishek
19 Mar, 2024, 19:53

It worked fine if I remove the attached file

Abhishek
19 Mar, 2024, 19:54
Abhishek
19 Mar, 2024, 19:56

Function Code:

TypeScript
namespace DotNetRuntime;

using System.Text;
using System.Text.RegularExpressions;

public class Handler
{
    public async Task<RuntimeOutput> Main(RuntimeContext Context)
    {
        Context.Log(Context.Req.BodyRaw);

        return Context.Res.Send("", 200, new Dictionary<string, string>()
        {
            { "Access-Control-Allow-Origin", "*" },
            { "Access-Control-Allow-Headers", "Content-Type" },
        });
    }
}
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