1
votes

Is it possible to get progress status, when upload large files to cloudinary from my server?

The problem:

We have an api endpoint, where we are sending the file to our server, then our server is doing some checks and is sending it to cloudinary. I am trying to find a way of showing the correct progress status. What I have tried is:

$stream = file_get_contents('php://input');
try{
    $resource = \Cloudinary\Uploader::upload($stream);
    $this->_resource = $resource;
} catch( Exception $exp ){
    echo "<pre>".print_r($exp)."</pre>";
    return false;
}

but this throws cloudinary exception that the file cannot be read.

1
Its only possible with Ajax, Jquery,.. etc. There is no Threading-Support in php - Vural

1 Answers

0
votes

You can refer to this piece of code in Cloudinary PHP sample project - https://github.com/cloudinary/cloudinary_php/blob/master/samples/PhotoAlbum/upload.php#L113 And here you can see how the progress bar is actually implemented (in the Cloudinary GEM sample project) - https://github.com/cloudinary/cloudinary_gem/blob/master/samples/photo_album/app/views/photos/new_direct.html.erb#L71