我用 laravel 创建了一个 API,用于将电影上传到 Godaddy 的服务器,最大 max_post_size 为 128mb,我想上传超过 1GB 大小的视频,我该怎么办?
我尝试从 php.ini 更改 max_post_size 但不超过 128mb。
* @param \Closure $next
* @return mixed
*
* @throws \Illuminate\Http\Exceptions\PostTooLargeException
*/
public function handle($request, Closure $next)
{
$max = $this->getPostMaxSize();
if ($max > 0 && $request->server('CONTENT_LENGTH') > $max) {
**throw new PostTooLargeException;**
}
return $next($request);
}
/**
* Determine the server 'post_max_size' as bytes.
*
* @return int
*/
protected function getPostMaxSize()
{
if (is_numeric($postMaxSize = ini_get('post_max_size'))) {
return (int) $postMaxSize;
}