blobstore

Decode an App Engine Blobkey to a Google Cloud Storage Filename

一笑奈何 提交于 2019-12-04 18:43:14
问题 I've got a database full of BlobKeys that were previously uploaded through the standard Google App Engine create_upload_url() process, and each of the uploads went to the same Google Cloud Storage bucket by setting the gs_bucket_name argument. What I'd like to do is be able to decode the existing blobkeys so I can get their Google Cloud Storage filenames. I understand that I could have been using the gs_object_name property from the FileInfo class, except: You must save the gs_object_name

Downloaded filename with Google App Engine Blobstore

99封情书 提交于 2019-12-04 18:42:26
问题 I'm using the Google App Engine Blobstore to store a range of file types (PDF, XLS, etc) and am trying to find a mechanism by which the original filename of the uploaded file - as stored in blob_info - can be used to name the downloaded file i.e. so that the user sees 'some_file.pdf' in the save dialogue rather than 'very_long_db_key.pdf'. I can't see anything in the docs that would allow this: http://code.google.com/appengine/docs/python/blobstore/overview.html I've seen hints in other posts

how to simulate image upload to google app engine blobstore

旧城冷巷雨未停 提交于 2019-12-04 17:03:37
I'm uploading images to the GAE blobstore using create_upload_url uploadURL = blobstore.create_upload_url('/upload') For the purpose of unit testing the gae code, can you simulate the image upload? OR should I insert the image data in my test bed and assume the upload is successful? If so, how do you upload an image to the test bed? Agree with @fredrik on what exactly you're testing there. Anyway, if you're doing some functional/blackbox/similar testing, you could simply use Webtest framework (see post method) and do the actual upload, e.g. payload = [(fieldname, filename)] test_app.post

Blobstore upload with javascript

佐手、 提交于 2019-12-04 12:13:09
This is the minimal declaration for the HTML in order to upload a file in Blobstore in the upload_url . What is required with this solution is required to click the Submit button in order the content to be submitted and get redirected. How can I do the post in the background with javascript or jQuery without losing the enctype? <form id="upload_file" action="{{upload_url}}" enctype="multipart/form-data" method="post"> <input type="file" name="file"> <input type="submit" name="submit" value="Submit"> </form> The jQuery Form plugin allows you to submit multipart forms in the background with Ajax

Cost of storing a file in Datastore vs Blobstore

浪子不回头ぞ 提交于 2019-12-04 11:09:25
问题 Question: Since every file in the blobstore has an associated BlobInfo entity in the datastore, do I get charged the cost of write/read of that entity just like any other datastore entity? Background: We store millions of images on App Engine, and we're currently storing them in datastore entities (the images are smaller than 1MB). I'm wondering if using the blobstore would reduce our cost. I'm not concerned about the cost of storage. The real cost is the act of writing and reading, so that's

ndb.BlobProperty vs BlobStore: which is more private and more secure

好久不见. 提交于 2019-12-04 04:27:22
I have been reading all over stackoverflow concerning datastore vs blobstore for storing and retrieving image files. Everything is pointing towards blobstore except one: privacy and security. In the datastore, the photos of my users are private: I have full control on who gets a blob. In the blobstore, however, anyone who knows the url can conceivable access my users photos? Is that true? Here is a quote that is supposed to give me peace of mind, but it's still not clear. So anyone with the blob key can still access the photos? (from Store Photos in Blobstore or as Blobs in Datastore - Which

Provide a callback URL in Google Cloud Storage signed URL

假如想象 提交于 2019-12-04 03:12:57
When uploading to GCS (Google Cloud Storage) using the BlobStore's createUploadURL function, I can provide a callback together with header data that will be POSTed to the callback URL. There doesn't seem to be a way to do that with GCS's signed URL's I know there is Object Change Notification but that won't allow the user to provide upload specific information in the header of a POST, the way it is possible with createUploadURL's callback. My feeling is, if createUploadURL can do it, there must be a way to do it with signed URL's, but I can't find any documentation on it. I was wondering if

Blobstore Images Disappearing on Google App Engine Development Server

为君一笑 提交于 2019-12-04 03:08:45
I'm using App Engine's high performance image serving on my site, and I'm able to get everything working properly on both my local machine and in production i.e. I can upload an image and successfully display the images using get_serving_url on the blob key. However, these images don't seem to persist on my development server, i.e. after I come back from a computer restart, the images no longer show up. The development server spits out: images_service_pb.ImagesServiceError.BAD_IMAGE_DATA which I'm guessing is actually because the underlying blobs are no longer there (although this is just a

How to set filename property in BlobStore?

亡梦爱人 提交于 2019-12-04 02:49:45
I'm programatically uploading image files and want to set the filename. When I upload a file via POST, the filename property is set automatically. However when using the method below, the filename is not getting set. image = urllib2.urlopen(url) file_name = files.blobstore.create(mime_type='image/png') with files.open(file_name, 'a') as f: f.write(image.read()) files.finalize(file_name) image_blob_key = files.blobstore.get_blob_key(file_name) Kevin P Parse the filename from the url (see related question here ). Then you can set it by adding an additional parameter to your files.blobstore

Stop Blob URL from expiring

百般思念 提交于 2019-12-04 01:57:58
问题 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? 回答1: 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: