Stop Blob URL from expiring

I am uploading images to the blob store. I have copied the example from here.

The only problem I encounter is: If I load the page with the form, and not immediately submit the image. The URL can expire and when I do try and load the image I get an error page. How can I check to see if the URL has expired and refresh the URL without the user knowing?

Answer

It seems the work around is getting the Blob URL when the user submits the form. This way you know that the URL can’t expire.

Using JQuery:

$.get("/blobUrl", function(data){
    $("#changeProfilePictureForm").attr('action', data);
    $("#changeProfilePictureForm").submit();
    $("#changeProfilePictureForm").hide();
    $("#loadingImg").show();
}); 

Leave a Reply

Your email address will not be published. Required fields are marked *