Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload to backblaze from client

Is there any way to upload directly to backblaze from the client? Right now images upload from the client to php and then to backblaze, so a file is uploaded twice. Can I just send the file to backblaze from Javascript?

like image 326
MasudM Avatar asked May 31 '16 20:05

MasudM


People also ask

Can I manually upload to Backblaze?

If you want to add files from your computer to a specific bucket/folder, simply drag from the computer source into that location for B2 Cloud Storage. You can also take files from your buckets in B2 and place those on your computer.

Can you upload to Backblaze?

Uploading Single FilesTo upload a single file, first you call b2_get_upload_url , to get a URL, then you call b2_upload_file using that URL. If everything goes as planned, that's it and you are done. The upload URL you get is targeted at a single storage pod in the Backblaze data center.


1 Answers

I think it is possible to upload directly as CORS is now available for b2. Post file directly with ajax to upload file.

Step 1. Get authorizationToken token using account id and application key

step 2. Get upload url using above authorizationToken.

Step 3. Send this url to client browser and upload file directly to b2.

Problem: if you need sha1 for verification that is possible only for HTML5 supported browser. Read more here

Is it possible to compute a file's SHA1 ID using Javascript?

https://developer.mozilla.org/en-US/docs/Web/API/File

https://www.backblaze.com/b2/docs/b2_upload_file.html

like image 59
Vishvendra Singh Avatar answered Oct 19 '22 23:10

Vishvendra Singh