Direct boot to s3 with progress bar using php

In connection with this issue Uploading a file directly to S3 with the progress bar , I would like to know if there is an update or other way to do this without using a flash or java applet?

I tried using this swfupload_s3 http://swfupload.org/forum/generaldiscussion/2185 , it works, but unfortunately the progress bar shoots up to 100% and found this.

(1) Local proxy servers and some antivirus behavior programs. Instead of sending the download to the server, the antivirus software intercepts the download and accepts the entire file. SWFUpload sent the whole file and displayed 100%. This happens quickly because nothing was sent, everything happened locally. the antivirus then scans the intercepted file and sends it to the server. Meanwhile, SWFupload is sitting at 100%. Once the antivirus sent a file to which the server responds, and SWFUpload "terminates"

(2) Known issue. We have already fixed this. There is no work. So the tool will work only for any client side, when the antivirus prevents it from downloading

http://swfupload.org/forum/generaldiscussion/642 (1)

http://code.google.com/p/swfupload/issues/detail?id= 213 (2)

I have been doing this for 2 days, but I can not find another way. Or not at all?

+5
source share
2 answers

There is an open-source php script with the S3 API for downloading files, it returns the real-time download progress, and you can configure the Uploader user interface if you want:

http://www.plupload.com/

0
source

I managed to get this to work on AWS 'PHP SDK v3.

$client = new S3Client(/* config */);

$result = $client->putObject([
    'Bucket'     => 'bucket-name',
    'Key'        => 'bucket-name/file.ext',
    'SourceFile' => 'local-file.ext',
    'ContentType' => 'application/pdf',
    '@http' => [
        'progress' => function ($downloadTotalSize, $downloadSizeSoFar, $uploadTotalSize, $uploadSizeSoFar) {
            printf(
                "%s of %s downloaded, %s of %s uploaded.\n",
                $downloadSizeSoFar,
                $downloadTotalSize,
                $uploadSizeSoFar,
                $uploadTotalSize
            );
        }
    ]
]);

This is explained in AWS docs - Section S3 Config . It works by exposing GuzzleHttp to a progressproperty called as described in this SO answer .

0
source

All Articles