Delete files from blobstore using file serving URL
        Posted  
        
            by 
                Arturo
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Arturo
        
        
        
        Published on 2012-11-03T10:57:47Z
        Indexed on 
            2012/11/03
            11:00 UTC
        
        
        Read the original article
        Hit count: 365
        
In my app (GWT on GAE) we are storing on our database the serving URL that is stored on blobstore. When user selects one of these files and clicks "delete", we need to delete the file from blobstore.
This is our code, but it is not deleting the file at all:
public void remove(String fileURL)
{
    BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
    String key = getBlobKeyFromURL(box.getImageURL());
    BlobKey blobKey = new BlobKey(key);
    blobstoreService.delete(blobKey);
}
Where fileURL looks like this:
http://lh6.ggpht.com/d5VC0ywISACeJRiC3zkzaZug-tPsaI_LGt93-e_ATGTCwnGLao4yTWjLVppQ
And getBlobKeyFromURL() would return what is after the last "/", in this example:
d5VC0ywISACeJRiC3zkzaZug-tPsaI_LGt93-e_ATGTCwnGLao4yTWjLVppQ
Could you please advice?
Thanks
© Stack Overflow or respective owner