Do i have convert local phone image url into base64 before sending to server to upload to S3 using multer?Why do we use Base64?React-native upload image to amazons s3How can i send a Image from Android File System via SuperAgentusing multer -s3 amazon server image upload error access deniedIs it possible to upload a server file to cloud using multer?Track progress for image upload using multer, express and multer-s3 for NodeJSrename uploaded Images on Multer-s3NodeJS - Validate extension before uploading multiple files with multer?Node.js Verify request params before uploading the file using multerReact Native - send image from local cache to firebase storagehow to read file from local storage?How can I parse what AWS amplify get me from S3 bucket, into something I can use?
What is this object?
Problem with pronounciation
How to befriend someone who doesn't like to talk?
That's not my X, its Y is too Z
What is the STRONGEST end-of-line knot to use if you want to use a steel-thimble at the end, so that you've got a steel-eyelet at the end of the line?
Forgot passport for Alaska cruise (Anchorage to Vancouver)
A life of PhD: is it feasible?
Why is it bad to use your whole foot in rock climbing
How to generate list of *all* available commands and functions?
How to change the headfont of newtheorem environments to match komascript font?
ASCII Meme Arrow Generator
What do you call the action of "describing events as they happen" like sports anchors do?
How (un)safe is it to ride barefoot?
Parsing text written the millitext font
C++ logging library
Are the guests in Westworld forbidden to tell the hosts that they are robots?
Do Veracrypt encrypted volumes have any kind of brute force protection?
Does it make sense to use a wavelet that is equal to a sine of one period?
Was self-modifying code possible using BASIC?
Quasar Redshifts
Who is "He that flies" in Lord of the Rings?
How many sets of dice do I need for D&D?
What would the consequences be of a high number of solar systems being within close proximity to one another?
Suppose leased car is totalled: what are financial implications?
Do i have convert local phone image url into base64 before sending to server to upload to S3 using multer?
Why do we use Base64?React-native upload image to amazons s3How can i send a Image from Android File System via SuperAgentusing multer -s3 amazon server image upload error access deniedIs it possible to upload a server file to cloud using multer?Track progress for image upload using multer, express and multer-s3 for NodeJSrename uploaded Images on Multer-s3NodeJS - Validate extension before uploading multiple files with multer?Node.js Verify request params before uploading the file using multerReact Native - send image from local cache to firebase storagehow to read file from local storage?How can I parse what AWS amplify get me from S3 bucket, into something I can use?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Here is the url i am getting from the local phone storage
"file:///storage/emulated/0/Pictures/1548694153266.jpg"
Should i really have to convert this to base64 to upload to s3.
If so is there any good library out there to convert the local url from
react native to base64
why is it important to convert this to base64?
What is the best way to go about it.
I can easily send images from local computer through postman. from postman i can select the image directly from computer as an image object. but in this case the url is not an image object?
exports.uploadProduct = async (req, res) =>
const uploads = await uploadMulti();
uploads(req, res, function (err)
let imageFiles = req.files;
const productImages = new Array();
for (var i = 0; i < imageFiles.length; i++)
fileLocation = imageFiles[i].location;
productImages.push(fileLocation)
console.log(productImages);
)
;
react-native multer-s3
add a comment |
Here is the url i am getting from the local phone storage
"file:///storage/emulated/0/Pictures/1548694153266.jpg"
Should i really have to convert this to base64 to upload to s3.
If so is there any good library out there to convert the local url from
react native to base64
why is it important to convert this to base64?
What is the best way to go about it.
I can easily send images from local computer through postman. from postman i can select the image directly from computer as an image object. but in this case the url is not an image object?
exports.uploadProduct = async (req, res) =>
const uploads = await uploadMulti();
uploads(req, res, function (err)
let imageFiles = req.files;
const productImages = new Array();
for (var i = 0; i < imageFiles.length; i++)
fileLocation = imageFiles[i].location;
productImages.push(fileLocation)
console.log(productImages);
)
;
react-native multer-s3
check the answer below hope it helps.
– Diksha Bhargava
Mar 26 at 6:18
add a comment |
Here is the url i am getting from the local phone storage
"file:///storage/emulated/0/Pictures/1548694153266.jpg"
Should i really have to convert this to base64 to upload to s3.
If so is there any good library out there to convert the local url from
react native to base64
why is it important to convert this to base64?
What is the best way to go about it.
I can easily send images from local computer through postman. from postman i can select the image directly from computer as an image object. but in this case the url is not an image object?
exports.uploadProduct = async (req, res) =>
const uploads = await uploadMulti();
uploads(req, res, function (err)
let imageFiles = req.files;
const productImages = new Array();
for (var i = 0; i < imageFiles.length; i++)
fileLocation = imageFiles[i].location;
productImages.push(fileLocation)
console.log(productImages);
)
;
react-native multer-s3
Here is the url i am getting from the local phone storage
"file:///storage/emulated/0/Pictures/1548694153266.jpg"
Should i really have to convert this to base64 to upload to s3.
If so is there any good library out there to convert the local url from
react native to base64
why is it important to convert this to base64?
What is the best way to go about it.
I can easily send images from local computer through postman. from postman i can select the image directly from computer as an image object. but in this case the url is not an image object?
exports.uploadProduct = async (req, res) =>
const uploads = await uploadMulti();
uploads(req, res, function (err)
let imageFiles = req.files;
const productImages = new Array();
for (var i = 0; i < imageFiles.length; i++)
fileLocation = imageFiles[i].location;
productImages.push(fileLocation)
console.log(productImages);
)
;
react-native multer-s3
react-native multer-s3
asked Mar 24 at 22:36
bee321bee321
153
153
check the answer below hope it helps.
– Diksha Bhargava
Mar 26 at 6:18
add a comment |
check the answer below hope it helps.
– Diksha Bhargava
Mar 26 at 6:18
check the answer below hope it helps.
– Diksha Bhargava
Mar 26 at 6:18
check the answer below hope it helps.
– Diksha Bhargava
Mar 26 at 6:18
add a comment |
2 Answers
2
active
oldest
votes
I am using react-native-image-picker this library it gives you both base64 string and local URL it depends on you which approach best for you.
const options =
title: 'Select Avatar',
storageOptions:
skipBackup: true,
path: 'images'
,
mediaType: 'photo',
quality: 0.01
const pickImage = onUri =>
ImagePicker.showImagePicker(options, response =>
let fileName = response.fileName
if (
Platform.OS === 'ios' &&
(fileName.endsWith('.heic') )
add a comment |
You can do this through these following steps :
Step 1: Install this package to convert it file url into base64. Here is the link for a good library to convert the local url from react native to base64
Step 2: Then in your code
import ImgToBase64 from 'react-native-image-base64';
Step 3: Make a function to convert your Image to base64
_convertImageToBaseSixFour()
ImgToBase64.getBase64String('YOUR_IMAGE_PATH') // path to your image from local storage
.then((base64String) =>
// Do your stuff with base64String
)
.catch(err => Alert.alert('Error' + err));
Step 4 : Call this function on a button press . You can do this accordingly.
// *** BUTTON *** //
<View style=styles.buttonContainer>
<Button onPress=this._convertImageToBaseSixFour title="Change to Base" color="#FFFFFF" accessibilityLabel="Tap"/> //Call on press
</View>
// *** STYLESHEET for Button *** //
const styles = StyleSheet.create(
container:
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#FFFFFF'
,
buttonContainer:
backgroundColor: '#2E9298',
borderRadius: 10,
padding: 10,
shadowColor: '#000000',
shadowOffset:
width: 0,
height: 3
,
shadowRadius: 10,
shadowOpacity: 0.25
)
Here you can find why is it important to convert this to base64
Sir, can i clear up one more question? I'm using a different image library which only gives me local url for the file: So what i want to do is to upload those image url to s3 via json. im trying to send those image url to s3 in the request body of the action. "productImages": [ "images": "file:///storage/emulated/0/Pictures/1548694153266.jpg", "images": "file:///storage/emulated/0/Pictures/1548694153266.jpg" ] . Using post man i can send those as "form-data". select local image and it works
– bee321
Mar 26 at 16:57
@bee321 This might be helpful checkout : stackoverflow.com/questions/30737226/…
– Diksha Bhargava
Mar 27 at 4:56
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55329247%2fdo-i-have-convert-local-phone-image-url-into-base64-before-sending-to-server-to%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I am using react-native-image-picker this library it gives you both base64 string and local URL it depends on you which approach best for you.
const options =
title: 'Select Avatar',
storageOptions:
skipBackup: true,
path: 'images'
,
mediaType: 'photo',
quality: 0.01
const pickImage = onUri =>
ImagePicker.showImagePicker(options, response =>
let fileName = response.fileName
if (
Platform.OS === 'ios' &&
(fileName.endsWith('.heic') )
add a comment |
I am using react-native-image-picker this library it gives you both base64 string and local URL it depends on you which approach best for you.
const options =
title: 'Select Avatar',
storageOptions:
skipBackup: true,
path: 'images'
,
mediaType: 'photo',
quality: 0.01
const pickImage = onUri =>
ImagePicker.showImagePicker(options, response =>
let fileName = response.fileName
if (
Platform.OS === 'ios' &&
(fileName.endsWith('.heic') )
add a comment |
I am using react-native-image-picker this library it gives you both base64 string and local URL it depends on you which approach best for you.
const options =
title: 'Select Avatar',
storageOptions:
skipBackup: true,
path: 'images'
,
mediaType: 'photo',
quality: 0.01
const pickImage = onUri =>
ImagePicker.showImagePicker(options, response =>
let fileName = response.fileName
if (
Platform.OS === 'ios' &&
(fileName.endsWith('.heic') )
I am using react-native-image-picker this library it gives you both base64 string and local URL it depends on you which approach best for you.
const options =
title: 'Select Avatar',
storageOptions:
skipBackup: true,
path: 'images'
,
mediaType: 'photo',
quality: 0.01
const pickImage = onUri =>
ImagePicker.showImagePicker(options, response =>
let fileName = response.fileName
if (
Platform.OS === 'ios' &&
(fileName.endsWith('.heic') )
answered Mar 25 at 8:40
A. WahabA. Wahab
7518
7518
add a comment |
add a comment |
You can do this through these following steps :
Step 1: Install this package to convert it file url into base64. Here is the link for a good library to convert the local url from react native to base64
Step 2: Then in your code
import ImgToBase64 from 'react-native-image-base64';
Step 3: Make a function to convert your Image to base64
_convertImageToBaseSixFour()
ImgToBase64.getBase64String('YOUR_IMAGE_PATH') // path to your image from local storage
.then((base64String) =>
// Do your stuff with base64String
)
.catch(err => Alert.alert('Error' + err));
Step 4 : Call this function on a button press . You can do this accordingly.
// *** BUTTON *** //
<View style=styles.buttonContainer>
<Button onPress=this._convertImageToBaseSixFour title="Change to Base" color="#FFFFFF" accessibilityLabel="Tap"/> //Call on press
</View>
// *** STYLESHEET for Button *** //
const styles = StyleSheet.create(
container:
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#FFFFFF'
,
buttonContainer:
backgroundColor: '#2E9298',
borderRadius: 10,
padding: 10,
shadowColor: '#000000',
shadowOffset:
width: 0,
height: 3
,
shadowRadius: 10,
shadowOpacity: 0.25
)
Here you can find why is it important to convert this to base64
Sir, can i clear up one more question? I'm using a different image library which only gives me local url for the file: So what i want to do is to upload those image url to s3 via json. im trying to send those image url to s3 in the request body of the action. "productImages": [ "images": "file:///storage/emulated/0/Pictures/1548694153266.jpg", "images": "file:///storage/emulated/0/Pictures/1548694153266.jpg" ] . Using post man i can send those as "form-data". select local image and it works
– bee321
Mar 26 at 16:57
@bee321 This might be helpful checkout : stackoverflow.com/questions/30737226/…
– Diksha Bhargava
Mar 27 at 4:56
add a comment |
You can do this through these following steps :
Step 1: Install this package to convert it file url into base64. Here is the link for a good library to convert the local url from react native to base64
Step 2: Then in your code
import ImgToBase64 from 'react-native-image-base64';
Step 3: Make a function to convert your Image to base64
_convertImageToBaseSixFour()
ImgToBase64.getBase64String('YOUR_IMAGE_PATH') // path to your image from local storage
.then((base64String) =>
// Do your stuff with base64String
)
.catch(err => Alert.alert('Error' + err));
Step 4 : Call this function on a button press . You can do this accordingly.
// *** BUTTON *** //
<View style=styles.buttonContainer>
<Button onPress=this._convertImageToBaseSixFour title="Change to Base" color="#FFFFFF" accessibilityLabel="Tap"/> //Call on press
</View>
// *** STYLESHEET for Button *** //
const styles = StyleSheet.create(
container:
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#FFFFFF'
,
buttonContainer:
backgroundColor: '#2E9298',
borderRadius: 10,
padding: 10,
shadowColor: '#000000',
shadowOffset:
width: 0,
height: 3
,
shadowRadius: 10,
shadowOpacity: 0.25
)
Here you can find why is it important to convert this to base64
Sir, can i clear up one more question? I'm using a different image library which only gives me local url for the file: So what i want to do is to upload those image url to s3 via json. im trying to send those image url to s3 in the request body of the action. "productImages": [ "images": "file:///storage/emulated/0/Pictures/1548694153266.jpg", "images": "file:///storage/emulated/0/Pictures/1548694153266.jpg" ] . Using post man i can send those as "form-data". select local image and it works
– bee321
Mar 26 at 16:57
@bee321 This might be helpful checkout : stackoverflow.com/questions/30737226/…
– Diksha Bhargava
Mar 27 at 4:56
add a comment |
You can do this through these following steps :
Step 1: Install this package to convert it file url into base64. Here is the link for a good library to convert the local url from react native to base64
Step 2: Then in your code
import ImgToBase64 from 'react-native-image-base64';
Step 3: Make a function to convert your Image to base64
_convertImageToBaseSixFour()
ImgToBase64.getBase64String('YOUR_IMAGE_PATH') // path to your image from local storage
.then((base64String) =>
// Do your stuff with base64String
)
.catch(err => Alert.alert('Error' + err));
Step 4 : Call this function on a button press . You can do this accordingly.
// *** BUTTON *** //
<View style=styles.buttonContainer>
<Button onPress=this._convertImageToBaseSixFour title="Change to Base" color="#FFFFFF" accessibilityLabel="Tap"/> //Call on press
</View>
// *** STYLESHEET for Button *** //
const styles = StyleSheet.create(
container:
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#FFFFFF'
,
buttonContainer:
backgroundColor: '#2E9298',
borderRadius: 10,
padding: 10,
shadowColor: '#000000',
shadowOffset:
width: 0,
height: 3
,
shadowRadius: 10,
shadowOpacity: 0.25
)
Here you can find why is it important to convert this to base64
You can do this through these following steps :
Step 1: Install this package to convert it file url into base64. Here is the link for a good library to convert the local url from react native to base64
Step 2: Then in your code
import ImgToBase64 from 'react-native-image-base64';
Step 3: Make a function to convert your Image to base64
_convertImageToBaseSixFour()
ImgToBase64.getBase64String('YOUR_IMAGE_PATH') // path to your image from local storage
.then((base64String) =>
// Do your stuff with base64String
)
.catch(err => Alert.alert('Error' + err));
Step 4 : Call this function on a button press . You can do this accordingly.
// *** BUTTON *** //
<View style=styles.buttonContainer>
<Button onPress=this._convertImageToBaseSixFour title="Change to Base" color="#FFFFFF" accessibilityLabel="Tap"/> //Call on press
</View>
// *** STYLESHEET for Button *** //
const styles = StyleSheet.create(
container:
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#FFFFFF'
,
buttonContainer:
backgroundColor: '#2E9298',
borderRadius: 10,
padding: 10,
shadowColor: '#000000',
shadowOffset:
width: 0,
height: 3
,
shadowRadius: 10,
shadowOpacity: 0.25
)
Here you can find why is it important to convert this to base64
edited Mar 25 at 11:24
answered Mar 25 at 11:12
Diksha BhargavaDiksha Bhargava
175114
175114
Sir, can i clear up one more question? I'm using a different image library which only gives me local url for the file: So what i want to do is to upload those image url to s3 via json. im trying to send those image url to s3 in the request body of the action. "productImages": [ "images": "file:///storage/emulated/0/Pictures/1548694153266.jpg", "images": "file:///storage/emulated/0/Pictures/1548694153266.jpg" ] . Using post man i can send those as "form-data". select local image and it works
– bee321
Mar 26 at 16:57
@bee321 This might be helpful checkout : stackoverflow.com/questions/30737226/…
– Diksha Bhargava
Mar 27 at 4:56
add a comment |
Sir, can i clear up one more question? I'm using a different image library which only gives me local url for the file: So what i want to do is to upload those image url to s3 via json. im trying to send those image url to s3 in the request body of the action. "productImages": [ "images": "file:///storage/emulated/0/Pictures/1548694153266.jpg", "images": "file:///storage/emulated/0/Pictures/1548694153266.jpg" ] . Using post man i can send those as "form-data". select local image and it works
– bee321
Mar 26 at 16:57
@bee321 This might be helpful checkout : stackoverflow.com/questions/30737226/…
– Diksha Bhargava
Mar 27 at 4:56
Sir, can i clear up one more question? I'm using a different image library which only gives me local url for the file: So what i want to do is to upload those image url to s3 via json. im trying to send those image url to s3 in the request body of the action. "productImages": [ "images": "file:///storage/emulated/0/Pictures/1548694153266.jpg", "images": "file:///storage/emulated/0/Pictures/1548694153266.jpg" ] . Using post man i can send those as "form-data". select local image and it works
– bee321
Mar 26 at 16:57
Sir, can i clear up one more question? I'm using a different image library which only gives me local url for the file: So what i want to do is to upload those image url to s3 via json. im trying to send those image url to s3 in the request body of the action. "productImages": [ "images": "file:///storage/emulated/0/Pictures/1548694153266.jpg", "images": "file:///storage/emulated/0/Pictures/1548694153266.jpg" ] . Using post man i can send those as "form-data". select local image and it works
– bee321
Mar 26 at 16:57
@bee321 This might be helpful checkout : stackoverflow.com/questions/30737226/…
– Diksha Bhargava
Mar 27 at 4:56
@bee321 This might be helpful checkout : stackoverflow.com/questions/30737226/…
– Diksha Bhargava
Mar 27 at 4:56
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55329247%2fdo-i-have-convert-local-phone-image-url-into-base64-before-sending-to-server-to%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
check the answer below hope it helps.
– Diksha Bhargava
Mar 26 at 6:18