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?
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.
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.
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
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