Laravel 5: How do you copy a local file to Amazon S3?

后端 未结 6 2104
心在旅途
心在旅途 2021-02-08 11:53

I\'m writing code in Laravel 5 to periodically backup a MySQL database. My code thus far looks like this:

    $filename = \'database_backup_\'.date(\'G_a_m_d_y\         


        
6条回答
  •  别跟我提以往
    2021-02-08 12:53

    I solved it in the following way:

    $contents = \File::get($destination);
    \Storage::disk('s3')
        ->put($s3Destination,$contents);
    

    Sometimes we don't get the data using $contents = Storage::get($file); - storage function so we have to give root path of the data using Laravel File instead of storage path using Storage.

提交回复
热议问题