Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
AWS PHP Upload cannot upload files larger than 15mb

I have been able to upload files to my bucket using the below code from the AWS PHP SDK. The problem is when I try to upload files that are larger than 15 mb, the script throws an error. Otherwise it works as expected. Any Ideas what I'm doing wrong? Thanks in advance.

require $dir . 'aws/aws-autoloader.php';
    $s3Client = new Aws\S3\S3Client(array(
    'version' => 'latest',
    'region' => 'us-west-2',
    'credentials' => array(
        'key' => 'KEY',
        'secret' => 'SECRET',
    )
));
$result = $s3Client->putObject(array(
    'Bucket' => 'eot-resources',
    'Key' => $org_id."_".$_FILES["fileToUpload"]["name"],
    'SourceFile' => $_FILES["fileToUpload"]["tmp_name"],
    'Body'        => new GuzzleHttp\Psr7\Stream(fopen($_FILES["fileToUpload"]["tmp_name"], 'r')),
    'ACL' => 'public-read',
    'StorageClass' => 'REDUCED_REDUNDANCY',
    'Metadata' => array(
        'Foo' => 'abc',
        'Baz' => '123'
    )
));
echo "URL: ".$result['ObjectURL'] . "<br>";

I get the following error when trying to upload a large file bigger than 15mb. Other than that it works.

Warning: fopen(): Filename cannot be empty in /Users/xxx/Code/xxx/wp-content/plugins/xxx/parts/part-upload_file.php on line 37.

Line 37 reads..

'Body'        => new GuzzleHttp\Psr7\Stream(fopen($_FILES["fileToUpload"]["tmp_name"], 'r')),

Any help/advice/tips would be appreciated.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I suspect your server has a limit on the size of file that can be uploaded. Check using phpinfo() and look for post_max_size and upload_max_filesize. Assuming that's the problem then you can increase the limit.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!