簡體   English   中英

Laravel 將 100 個圖像上傳到 Amazon S3 存儲桶

[英]Laravel Upload 100 Images to Amazon S3 bucket

我有一個電子商務網站,其中一些產品有 100 張圖片。

如果圖片數量超過 20 張圖片,則僅上傳前 20 張圖片!

請指教。

這是上傳代碼。

    if($request->file('product_image')){
        foreach($request->file('product_image') as $image)
        {

            $filename = $this->millitime().'.'.$image->getClientOriginalExtension();
            $location = public_path().'/backend_assets/uploaded_files/products/'.$filename;
            Image::make($image)->save($location);
            $s3_filePath = 'images/product-images/'. $filename;
            Storage::disk('s3')->put($s3_filePath, file_get_contents($location)); 
            ProductImages::create([
                'product_id'=> $product->id,
                'product_name' => $product->name_english,
                'image' => $filename
            ]);

            if(File::exists($location)) {
                File::delete($location);
            }
        }
    }

這與 Laravel 無關。 請更改 max_file_uploads

在 php.ini

max_file_uploads=100

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM