Upload file via Channel API - google-app-engine

I read the article which talk about Blobstore (https://developers.google.com/appengine/docs/go/blobstore/).
I would to know if I can use Channel API to send a file, and if it's possible, how.

The Channel API is designed to send text. So instead of sending a file via the Channel API, you would send a pointer to the file for the client to download. The pointer may be a datastore key, a blobstore key, a URL etc - depends on your backend really.

Related

How to convert a blob url of audio to normal url for downloading files in react?

I used a voice recorder in my application, the voice data contains a blobUrl, that I want to send that url to server for downloading it, but it is not a normal url. is there any way to convert my blob url of audio to a normal url?
blob:http://localhost:3001/dfafdba3-24f4-4f36-b9d8-13f4d9634acc
this might be what you're looking for:
https://stackoverflow.com/a/71885435/11483674
In summary: you extract the data from your browser's blobUrl, make a file out of that and send it over a request to your backend.

What's the best way to control S3?

I am using:
React as front end,
.net core as back end.
I have s3 bucket
Purpose: upload file to S3
allow the users to upload directly via browser ( can be via was sdk or HTTP post)
What I want to achieve:
because of the s3 key, I don't want to give the key to one user, otherwise, one user can upload and read other users file.
I don't want to pass the file to the server, then upload via server.
What's the best way for me to control this? getting a unique key via the my backend server for a particular user?
Or any suggested link/training I can go to?
You can generate an S3 presigned POST URL in the backend using the secret access keys of an appropriate IAM user (let's call it User A). Then return this presigned POST URL to the client, and now client can use this presigned POST URL upload files to S3 bucket on behalf of User A. Here is the documentation which describes how to POST an object to S3 in detail.

Twilio MMS Send Local File

We can send MMS using Twilio api in Salesforce.
As i know that using that code i can send MMS using Twilio in Salesforce.
Sending a MMS
properties.add(new TwilioNameValuePair('MediaUrl','https://www.twilio.com/packages/company/img/logos_downloadable_round.png'));
But it's seams that we have need to pass media file url.
But how can we take a input of file form Local machine and send them using Twilio MMS?
You can use twilio assets for sending local files.
- First you need to upload the local files on twilio assets.
- use the assets url and media url for sending Mms
Rajendra, hello! Megan from Twilio here.
This sounds similar to what I ran into building an OpenCV MMS implementation in this blog post.
The example there is in Python specifically, after writing an image to my local filesystem and making the desired modifications on it, I send it through:
#app.route('/uploads/<filename>', methods=['GET', 'POST'])
def uploaded_file(filename):
return send_from_directory(UPLOAD_FOLDER,
filename)
which handles the delivery of the following TwiML:
message.media('http://YourNgrokURL/uploads/{}'.format(filename))
You'll be needing the equivalent of Flask's send_from_directory to handle this in your implementation.
Hope this helps!

Send large POST request from Google App Engine

I have to send a large POST request as part of a RESTful API call. The payload is around 80MB in size. When I try to send this in GAE Java, I get an exception saying it is not a permissible size because it is too large. What are the most common ways people send such large POST request? In my case, this request only happens very rarely, maybe once in 6 months or so. Nonetheless, I would need to have this feature.
From the docs - https://cloud.google.com/appengine/docs/quotas#Requests
The amount of data received by the application from requests. Each incoming HTTP request can be no larger than 32MB.
This includes:
data received by the application in secure requests and non-secure requests
uploads to the Blobstore
data received in response to HTTP requests by the URL fetch service
So write it to GCS or S3 or google sheets, docs etc... (anywhere that allows you to store a larger payload, then process this via a task queue.

SSL Post Request to Appengine

I need to develop a web-based service on Google Appengine (Python 2.7) that involves the sending of sensitive data from a third-party website over to my site (preferably through SSL). Say that my url is https://example.appspot.com, and I want the third-party site http://example.com to send two values through a POST request, one is username and the other is password, to https://example.appspot.com/receiverhandler. This receiver handler is class ReceiverHandler(webapp2.RequestHandler). My question is basically: how can I send this POST data through an SSL connection? I'm not entirely familiar with the SSL protocol, so I have no idea where to begin.
Using urlfetch, just send it to the SSL-secured url: https://example.appspot.com/receiverhandler
This gives great explanation of how to do it, using POST params (payload):
https://developers.google.com/appengine/docs/python/urlfetch/

Resources