robbiepaul / cloudconvert-laravel

A Laravel wrapper for the CloudConvert API
177 stars 34 forks source link

Cannot save to S3 as part of a callback. #12

Closed IanCaunce closed 9 years ago

IanCaunce commented 9 years ago

I have been trying in vein to say a file to S3 as part of a callback.

The code I have tried is:

CloudConvert::useProcess($processUrl)
    ->save(CloudConvert::S3('some/aws/key.pdf'));

No errors are thrown. It simply doesn't upload the file. Is this something which is supported?

As a temporary workaround I use the following code:

$cloudConvert = CloudConvert::useProcess($processUrl);

$file = $cloudConvert->getProcess()->download();

Storage::put('some/aws/key.pdf', $file);

Thanks, Ian

robbiepaul commented 9 years ago

Hi Ian,

Saving to S3 storage is a feature of the official API (https://cloudconvert.com/apidoc#s3) as such needs to be defined when the process begins. CloudConvert will automatically save the file to your bucket when the process is complete.

I haven't had a chance to test it yet but this should work:

CloudConvert::file('/a/path/to/file.doc')
            ->callback('http://myserver.com/callback.php')
            ->convert(CloudConvert::S3('some/aws/key.pdf'));
IanCaunce commented 9 years ago

I misinterpretation its functionality. Thanks for the reply.