简体   繁体   中英

Vimeo Upload Video Request Entity Too Large 413 Error, RestSharp

I'm using RestSharp to try to upload a video to Vimeo, but I keep getting an Http 413 RequestEntityTooLarge error. I think I'm sending just the bytes and not the encoded video, so I'm not sure what is wrong. This is my code:

//construct request
RestRequest request = new RestRequest(endpoint);
request.Method = Method.PUT;

//add headers
request.AddHeader("Authorization", string.Format("Bearer {0}", _accessToken));
request.AddHeader("Content-Length", fileSize.ToString());
request.AddHeader("Content-Type", mimeType);
request.AddParameter(mimeType, fileData, ParameterType.RequestBody);

//allow for the transfer of larger files (10min timeout)
request.Timeout = 2400000;

// Upload the file
IRestResponse uploadResponse = _client.Execute(request);

This has nothing to do with your code. Vimeo is telling you what's wrong; The file you're uploading is too large for them to accept.

Double check that your fileSize variable is correct. If incorrect, Vimeo may thing you're trying to upload a file that's much larger than it really is.

If the file is, in fact, too large, compress it using any number of file compressors and then upload that.

UPDATE: According to this forum post , you need to make sure you're not encoding your file in any way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM