I am planning to create a web app that allows users to downgrade their visual studio project files. However, It seems Google App Engine accepts files uploading and flat file storing on the Google Server through db.TextProperty
and db.BlobProperty
.
I'll be glad anyone can provide code sample (both the client and the server side) on how this can be done.
Upload and downloading files and folders Files and folders can only be uploaded to and downloaded from your home directory. In your Cloud Shell Editor Explorer, right-click a directory or file and then click Copy Download Link, Download, or Upload Files. Alternatively, you can navigate to File > Download/Upload Files.
In the Google Cloud console, go to the Cloud Storage Buckets page. In the list of buckets, click on the name of the bucket that you want to upload an object to. In the Objects tab for the bucket, either: Drag and drop the desired files from your desktop or file manager to the main pane in the console.
In fact, this question is answered in the App Egnine documentation. See an example on Uploading User Images.
HTML code, inside <form></form>:
<input type="file" name="img"/>
Python code:
class Guestbook(webapp.RequestHandler): def post(self): greeting = Greeting() if users.get_current_user(): greeting.author = users.get_current_user() greeting.content = self.request.get("content") avatar = self.request.get("img") greeting.avatar = db.Blob(avatar) greeting.put() self.redirect('/')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With