joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.81k stars 770 forks source link

how to upload an base64 string image to azure blob #373

Closed ManuRodgers closed 4 years ago

ManuRodgers commented 5 years ago

Hi ! Thank you for reporting an issue, but we would like to remind you, we have a trouble shooting page in our wiki. You may want to take a look on that page or find issues tagged "trouble shooting" :p

nik910 commented 4 years ago

const assetPath = ${_trimEnd(sasContainerUri, '/')}/${container}/${uploadPath};

await RNFetchBlob.fetch('PUT', ${assetPath}?${sasToken}, { 'x-ms-blob-type': 'BlockBlob', 'content-type': 'application/octet-stream', 'x-ms-blob-content-type': file.type, }, base64String);

return assetPath;

AnirudhWT commented 4 years ago

worked thank you...

votrunghau11 commented 4 years ago

const assetPath = ${_trimEnd(sasContainerUri, '/')}/${container}/${uploadPath};

await RNFetchBlob.fetch('PUT', ${assetPath}?${sasToken}, { 'x-ms-blob-type': 'BlockBlob', 'content-type': 'application/octet-stream', 'x-ms-blob-content-type': file.type, }, base64String);

return assetPath;

hi @nik910
i want to upload a video from react native client! now i'm stuck with azure blob storage can u help me how to upload it with using RNFetchBlob

AnirudhWT commented 4 years ago

I have tested to upload the video from my system to the azure storage blob and that was successful.I used postman for testing the scenario and i am sure it will also work in React-native as well. Enlisted steps i didPUT ={bloburl}/{containername}/{filename}?{sastoken} headers were: Content-Type :FileTypex-ms-blob-type:BlockBlob Content-Length:size in kbs and in the body i uploaded the video file

votrunghau11 commented 4 years ago

can you give me an example @AnirudhWT i'm really stuck right now

AnirudhWT commented 4 years ago

are you facing issue in uploading or converting the video in base64 ? Since uploading part is clear I think.please address the exact issue.

votrunghau11 commented 4 years ago

yub bro

i'm stuck right now i follow your step but when i upload it idont receive any response. i cant check is it saved in azure storage because i dont have azure account (company sercurity problems) so how can i check it ??

and i'm just a newbie please help me as soon as if you can this is my code RNFetchBlob.fetch(fetchConfig, https://${azureStorageBlob.blobUrl}/${ azureStorageBlob.containerName}/${azureStorageBlob.videoName}?${ azureStorageBlob.sasToken}, { 'x-ms-blob-type': 'BlockBlob', 'content-type': 'application/octet-stream', 'x-ms-blob-content-type': file.type, }, RNFetchBlob.wrap(localUri))

Vào Th 2, 23 thg 3, 2020 vào lúc 13:39 AnirudhWT notifications@github.com đã viết:

are you facing issue in uploading or converting the video in base64 ? Since uploading part is clear I think.please address the exact issue.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/joltup/rn-fetch-blob/issues/373#issuecomment-602413514, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFOSUSFJOWHRO5K37VYXUDLRI37Y5ANCNFSM4HWJJPYQ .

AnirudhWT commented 4 years ago

if you want to test strictly from react-native then you should have access to the account.. without that you wont be able to confirm it is uploaded or not. or you can also check by listing all the blobs by using the enlisted method.

blobService.listBlobsSegmented('mycontainer', null, function (error, results) { if (error) { // List blobs error } else { for (var i = 0, blob; blob = results.entries[i]; i++) { // Deal with blob object } } });

votrunghau11 commented 4 years ago

how can i check when alias name of container always change

Vào Th 2, 23 thg 3, 2020 vào lúc 13:56 AnirudhWT notifications@github.com đã viết:

if you want to test strictly from react-native then you should have access to the account.. without that you wont be able to confirm it is uploaded or not. or you can also check by listing all the blobs by using the enlisted method.

blobService.listBlobsSegmented('mycontainer', null, function (error, results) { if (error) { // List blobs error } else { for (var i = 0, blob; blob = results.entries[i]; i++) { // Deal with blob object } } });

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/joltup/rn-fetch-blob/issues/373#issuecomment-602418844, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFOSUSGGKPCFS3FOYRVMO3TRI4B3LANCNFSM4HWJJPYQ .

votrunghau11 commented 4 years ago

if you have any chat channel can you give me ? it's easier to talk with u

Vào Th 2, 23 thg 3, 2020 vào lúc 14:51 Trung Hậu Võ vth1122@gmail.com đã viết:

how can i check when alias name of container always change

Vào Th 2, 23 thg 3, 2020 vào lúc 13:56 AnirudhWT < notifications@github.com> đã viết:

if you want to test strictly from react-native then you should have access to the account.. without that you wont be able to confirm it is uploaded or not. or you can also check by listing all the blobs by using the enlisted method.

blobService.listBlobsSegmented('mycontainer', null, function (error, results) { if (error) { // List blobs error } else { for (var i = 0, blob; blob = results.entries[i]; i++) { // Deal with blob object } } });

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/joltup/rn-fetch-blob/issues/373#issuecomment-602418844, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFOSUSGGKPCFS3FOYRVMO3TRI4B3LANCNFSM4HWJJPYQ .

sharadkatre19 commented 3 years ago

Can we upload with file URI & custom name to file to azure blob storage? Can you share some sample code? @nik910 I have tried your example but getting the 409 status code. The requested operation is not allowed in the state on the entity.