1

I use Flurl.Http in UWP and I can make a request to upload my photo to the server:

IBuffer buffer = await Windows.Storage.FileIO.ReadBufferAsync(file);
            string res = "";
            try
            {
                res = await upload_url.PostMultipartAsync(mp => mp
                    .AddFile("file", buffer.AsStream(), "story.png", null, (int)buffer.Length)
                    ).ReceiveString();
            }

But when I try to upload a video file in the same request form:

                IBuffer buffer = await FileIO.ReadBufferAsync(file);
            string res = "";
            try
            {
                res = await upload_url.PostMultipartAsync(mp => mp
                    .AddFile("video_file", buffer.AsStream(), "story.mp4", null, (int)buffer.Length)                        
                    ).ReceiveString();
            }

I get an 413 Error.

All answers I've found are relate to WCF application.

How I can change limit of max request length?:(

  • 1
    Possible duplicate of [(413) Request Entity Too Large | uploadReadAheadSize](https://stackoverflow.com/questions/10122957/413-request-entity-too-large-uploadreadaheadsize) – Razvan Dumitru Apr 23 '18 at 10:31
  • The answers you've found are correct - this is a server-side issue. Is the server app yours? If not you might be out of luck unless the server developers are willing to change the max allowed size. – Todd Menier Apr 23 '18 at 13:22
  • @ToddMenier No, the server isn't mine, I make an API call to some service and receive an URL where I can upload my files. The I make POST request with file's bytes. The server actually allow me upload to 10Mb. – Ivan Reshetov Apr 23 '18 at 14:20
  • @ToddMenier Or do I need to add to my Solution new WCF project, and send a request over it? – Ivan Reshetov Apr 23 '18 at 14:25
  • The server is rejecting the request, saying that it's too large. You can't program around that on the client side. If you think the size of your file is well within the range of what they say they accept, you should contact them and ask why they are rejecting it. – Todd Menier Apr 23 '18 at 14:34
  • @ToddMenier Hm... It's strange... I made a request from service's API Explorer, sent a test file and it's was successfully. Okey, I'll message to the support. – Ivan Reshetov Apr 23 '18 at 14:38
  • @ToddMenier Support says that this problem can't be on their part :( – Ivan Reshetov May 06 '18 at 12:50
  • What's the result if you post the same file from Postman? – Sunteen Wu May 08 '18 at 09:40

0 Answers0