cloudconvert / cloudconvert-php

CloudConvert PHP SDK
https://cloudconvert.com/api/v2
MIT License
222 stars 84 forks source link

Issue downloading the file #99

Closed Mubashir-rehma closed 1 year ago

Mubashir-rehma commented 2 years ago

I am using this snippet to download the file. but the window keeps loading and doesn't download any file even after I submit the file. the behavior is a bit annoying like when I refresh the page having this snippet added, the job gets started while the page is still loading, and if I upload the file, the job even gets completed but the file doesn't download at all and still the page keeps loading.

$cloudconvert->jobs()->wait($job); // Wait for job completion

    foreach ($job->getExportUrls() as $file) {

        $source = $cloudconvert->getHttpTransport()->download($file->url)->detach();
        $dest = fopen('output/' . $file->filename, 'w');

        stream_copy_to_stream($source, $dest);
    }