How to upload blob with Bulletproof php - upload

I generate a blob jpeg in client side and need to send it to server using ajax and bulletproof php, is it possible without using database ?
Can i convert blob to a file client side so bulletproof can send it to server ?

Related

Is it possible to upload directly without touching my server?

Is it possible to use carrier wave to upload directly to amazon's S3 without using my server?
What i mean is, I don't want the images first going to my ec2 instance, and then uploaded to s3. I believe there is a way to upload directly to S3 to save my server's resources from having to process/stream the file.
I am just looking into carierwave, does it support nice html5 uploads where the user can just drag and drop the file on the web page?
If you want to upload directly to S3 from the browser you must do it with Javascript.
Heroku provides a nice tutorial : https://devcenter.heroku.com/articles/direct-to-s3-image-uploads-in-rails
Once uploaded, you can pass the finale S3 public URL of the image in a hidden field and download it server-side with carrierwave for further manipulation (resizing, ...)

Can CDNs handle base64 encoded data?

I'm trying to make an app where I take pictures from users add them to a canvas, draw stuff in them, then convert them to a base64 string and upload them.
For this purpose I'm considering the possibility to use a cdn but can't find information on what I can upload to them and how the client side uploading works. I'd like to be able to send the image as base64 and the name to be given to the file, so that when it arrives to the origin cdn, the base64 image is decoded and saved under the specified name (which I will add to the database on the server).Is this possible?Can I have some kind of save.php file on the origin cdn where I write my logic to save the file and to which I'll send XHR requests? Or how this whole thing work?I know this question may sound trivial but I'm looking for it for hours and still didn't find anything which explains in detail how the client side uploading work for CDNs.
CDNs usually do not provide such uploading service for client side, so you can not do it in this way.

Upload file with api and carrierwave

I'm writting api for webservice, and i need to provide ability for users to upload files using this api.
For my uploads i'm using carrierwave, but not sure how do i pass file from api request to carrierwave, and how the file should be sent from client machine to server
Basically it is based on the tool which is used by the API consumer. If API consumer is using ruby then can consume it by passing File object, or using httmultiparty gem we can upload the file.
For you reference https://github.com/jwagener/httmultiparty. Please let me know if you need more help.
Usually I implement file uploads over a REST API by allowing clients to send a PUT request with the base64 encoded binary data of the file inside the request body.
Then you can route the client request to your CarrierWave uploader, which can decode the binary data contained in the request body using something like FilelessIO.new(Base64.decode64(encoded_file))
Try RestClient. It encapsulates net/http with cool features like multipart form data:
require 'rest_client'
RestClient.post('http://localhost:3000/foo',
:name_of_file_param => File.new('/path/to/file'))
It also supports streaming.
gem install rest-client will get you started.

PGP encryption from client side (js) with JSF 2

when client select a file with upload component, I need to implement PGP encryption from client side with JSF 2 (Create a faces component) or primefaces 2.2 (I dont see anything from client side in the upload component), because the file has confidential information, encryption from the server does not help, can you give me some help or any idea?
JSF/PrimeFaces wont help you much - if you have to encrypt the file before sending it will all have to be done client side in JavaScript. So you have to read the file in JS, encrypt in JS, and then you can encode encrypted contents with something like Base64, assign that value to inputText and then submit to server.
See JavaScript read file contents
and
http://www.hanewin.net/encrypt/

stream an AWS S3 object in binary

From what I found both libraries aws-sdk and aws-s3 (Ruby) provide methods to download S3 object data only in string chunks. I'd like to be able to read it in binary chunks, so that it resembles file I/O and be more efficient. Does anyone know if there is a supported way to do it? One hack that I thought about is creating an access URL for the S3 object (S3 functionality) and download the file with some HTTP client library. What's a good library for that in Ruby?
P.S.: I need to stream data, so that I can decrypt files on-the-fly. AWS has client-side encryption library only in Java SDK.
So, it turns out in ruby (since 1.9?) a string of encoding ASCII-8BIT is used as a binary block, so you have to work with that. P.S.: net/http is a ruby http client library that can be used to read response body.

Resources