【问题标题】:Vimeo Upload Video Request Entity Too Large 413 Error, RestSharpVimeo 上传视频请求实体太大 413 错误,RestSharp
【发布时间】:2018-01-07 14:20:10
【问题描述】:

我正在使用 RestSharp 尝试将视频上传到 Vimeo,但我不断收到 Http 413 RequestEntityTooLarge 错误。我想我只是发送字节而不是编码的视频,所以我不确定出了什么问题。这是我的代码:

//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);

【问题讨论】:

  • 您要上传的文件有多大(以字节为单位)?
  • 它说文件是56657198字节,大约54MB。这对 Vimeo 来说会不会太大?

标签: c# vimeo restsharp vimeo-api


【解决方案1】:

这与您的代码无关。 Vimeo 告诉你出了什么问题;您上传的文件太大,他们无法接受。

仔细检查您的 fileSize 变量是否正确。如果不正确,Vimeo 可能会认为您正在尝试上传比实际大得多的文件。

如果文件实际上太大,请使用任意数量的文件压缩器对其进行压缩,然后上传。

更新:根据this forum post,您需要确保没有以任何方式对文件进行编码。

【讨论】:

  • 所以我要上传的文件是 54MB。 fileSize 变量是 56657198
猜你喜欢
  • 2017-02-16
  • 2016-02-01
  • 1970-01-01
  • 2016-07-16
  • 2017-03-05
  • 1970-01-01
  • 2016-09-26
  • 2014-12-30
  • 2014-12-23
相关资源
最近更新 更多