简体   繁体   中英

How can I upload a file in hyperstack?

Basically the title. The documentation says to use Operations in place of traditional APIs, but I can't seem to find a way to handle file uploads.

Is this even possible in hyperstack?

There are exceptions to every rule https://github.com/hyperstack-org/hyperstack/issues/174

Fileuploads would require a special parameter type in operations.

Just use a regular controller to define the endpoint. You can still access your end point with an HTTP.post in your client ruby code.

HOWEVER that said, these days most file uploads go directly to some cloud storage like Amazon AWS. In this case you would indeed define an Operation to get the temporary storage URL from the cloud storage provider, as this all needs to be run server side.

So you would define an operation that returns the cloud storage URL (which usually lasts just a few minutes), the you would post to that URL.

Inside the operation you would directly contact the cloud storage provider with your credentials, or use the Fog gem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM