How to upload text data with files in multipart form data? - multipartform-data

Currently I am working on a project in which i want to send item id with the image i uploaded so that later on i can change the name of the image in the backend. So how can i achieve this or how to change the name of the image in frontend ?

Related

display and save a local image into database in react js

I'am developing a blog website using react.js where users can post and comment ...
so we know that a user can comment with an image ,and let's say he want to upload a local image that stored in his machine,i want to display that image as a comment and save it into postgres database which i'am using for that.
My question is what are the steps that i should follow to achieve my purpose,thanks in advance.
If you have to do in simple steps, you can save the image to base64, its just string representation of an image. So it can be saved in DB directly and when you have to show it just decode the string and display it accordingly.
References :-
https://github.com/dankogai/js-base64#readme
https://scotch.io/tutorials/how-to-encode-and-decode-strings-with-base64-in-javascript
Alternatively, what you can do when user selects an image, then upload that image to your server and get the path to that(multipart file upload) and from path you can show it where you want to show.
References :-
how to send a multipart/form-data from React.js with an image?
I hope it helps, Thanks :)

Image on http url shows old image instead of updated image

I am loading image from http url inside tag.
However, I have updated the image from backend but on mobile device I am not able to see updated image.
It's always showing me the old image.
When serving the image from backend, add a timestamp attribute to the image url as a query param, i.e <image_url>?t=12233554.
You can fine-tune this method more -
like when storing the image, put the timestamp for that time only as a query param, and directly serve the file to the user.

How to preview the thumbnail of any file

I have number of files like .doc,.pptx, .avi.. that means i have uploaded number of files to my database using the angularjs and node api, now my query is,
How to show those uploaded file preview as thumbnail.

How to store images in firebase using URL from cloud storage service?

Hi I am developing an ionic app using firebase as my database.
I read this question.
I understand it and have a more specific question.
I uploaded an image on amazon s3, imgur and filestack, and tried all three in firebase using data:url/<the url of image> and data:image/jpeg;<url of image>.
Am I typing something wrong into firebase?
The image does not come up. I do not want to write code in the app to upload the image etc, I just simply want an image to display on the app beside some data corresponding to an item in my firebase database.
I have read about base64, do I have to use it in this case?
(Optional) Perhaps If you could expand on the steps of doing this:
"You can use a filepicker to get the image file. Then you can host the image however you want, i prefer amazon s3. Once the image is hosted you can display the image using the url generated for the image."
I don't have much ionic experience, but why not just save the direct path to the image url and not include the data:url/ portion.
Simply store the url in firebase and then when it's retrieved inject it into your img src.

Send angular upload file to server

I am trying to upload some image file using angularjs, By using angular uploader. I am able to select the image and it is available in scope model also. My requirement is when I post the model through http post the selected image file should be available in one of model property.
Below is the code for selecting the image and storing the image in model property.
<button" ng-model="AllDate.StudentPhoto">Upload Photo</button>
After selecting I am posting the model to the server and I want that image file inside that model property,
Thanks in advance.

Resources