humanmade / S3-Uploads

The WordPress Plugin to Store Uploads on Amazon S3
1.94k stars 391 forks source link

Warning: fwrite() expects parameter 1 to be resource, boolean given #331

Open mattpramschufer opened 5 years ago

mattpramschufer commented 5 years ago

Warning: fwrite() expects parameter 1 to be resource, boolean given in /var/www/wp-content/plugins/S3-Uploads/vendor/aws/aws-sdk-php/src/S3/Transfer.php on line 425

Latest version, the files are still uploaded just a ton of warnings

thisboyiscrazy commented 5 years ago

I am getting the same problem.

thisboyiscrazy commented 5 years ago

The problem is aws-sdk, Tansfer.php line 126 to 132 it expects $options['debug'] to true or unset.

Changing Lines 231 in class-s3-cli-command.php to

        $transfer_args = [
            'concurrency' => $args_assoc['concurrency'],
            'before'      => function ( AWS\Command $command ) {
                if ( in_array( $command->getName(), [ 'PutObject', 'CreateMultipartUpload' ], true ) ) {
                    $acl = defined( 'S3_UPLOADS_OBJECT_ACL' ) ? S3_UPLOADS_OBJECT_ACL : 'public-read';
                    $command['ACL'] = $acl;
                }
            },
        ];

        if($args_assoc['verbose']) { $transfer_args['debug'] = true; };

Fixed it.

AlanJIsaacson commented 5 years ago

I have the same problem, but the fix above didn't resolve it

ishigami commented 4 years ago

For me the following command works for me:

wp s3-uploads upload-directory /fullpath/to/uploads/ s3://uploads --verbose

Just add the option --verbose