0

我用 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;
        }
4

1 回答 1

0

我刚刚意识到 Godaddy 和其他共享主机不会给你一个免费空间来存储你的大文件,你需要一个 VPS(虚拟专用服务器),你可以像https://www.vpsserver.com一样在线获取它/

于 2019-07-21T08:40:35.707 回答