I would like to display file upload progress in a progress bar on my web page while uploading a file to Amazon S3 …
On my web page I select a file from a file input which calls my controller with a Ajax POST request .
In the controller I extract the file from the posted request.
var hpf = Request.Files[1];
Then I call a method that uses the AmazonS3Client..
UploadVideoMultiPart(hpf.InputStream,fileName)
This above method completes the upload to S3 perfectly fine and during that process repeatedly sends the number bytes uploaded .
public static void UploadPartProgressEventCallback(object sender, StreamTransferProgressArgs e)
{// Process event.
Var progress = (string.Format("{0}/{1}", e.TransferredBytes, totalContentLength));
}
Example: TransferredBytes TotalBytes 8778 152652556 2562 152652556
How can I send back the data from the UploadPartProgressEventCallback to the browser without stopping the upload thread.
If I could get this data I would be able to update my progress bar.
Aucun commentaire:
Enregistrer un commentaire