Upload a temporary image on AngularJS - angularjs

I want to simply upload an image so I have a path that links to it temporarily (not the user's local route), that way I will send that path to the backend and there it will be saved on a database. Since it is only for a few seconds until the backend saves it permanently, I want it to be deleted afterwards.
I've been trying with fileReader but so far I have no clue on how to achieve this.

Related

Any Way to generate pdf in Memory with React and post the pdf to a service?

I have gone through posts where they are able to generate pdf and save in react.
But I don't want to save the pdf instead want to keep it in memory or send it as a stream to the service.

Saving compressed base64 string in local database is a good practise?

I'm making an app with react native and spring boot for backend, what is the best way to save images? Is it fine to get compressed base64 string from image crop picker and save it in the database?
I test it and it works. I chose 10 MB image and when it saved after compressing, it becomes 182kb and i test the fetching speed and its fast. so is it fine to do that? If not, what should i do?
i know i should upload the image in a folder in the server and put the path in the database but then what ? In React Native you cant put path for image as variable like:
<Image source={require(x) } />
and x is the saved path in database, i know that the hole thing "require (/path/image name)" must be a variable to work but if i put in the database it doesn't work because it will be saved as string but it must be jxe to work so what is the solution?

How to solve local caching?

My question is the next:
Situation:
I have an ImagesScreen where I can upload some additional photos, delete them, etc.
When someone add a new photo (from the gallery, react-native-image-crop), I want to make a copy from the image, save it to the local storage (so even if someone delete the image from the gallery I got my own copy in my local storage).
Why:
I do not want to immediately send the photos toward the API, I just want to backup them every day, so when I make a copy from the selected photo(s) I want to retrieve the uri of the local stored image. (not the uri of the image in the gallery)
How would you guys handle this case?
its complicated, try https://github.com/itinance/react-native-fs, is suitable for you.
there you can handle cached dirs, tmp dirs, delete files/save files

Store an image in local application folder in AngularJS

In my AngularJS application I need to store the images that a user choose from his device, in the application folder.
Only the device used to choose the image has to see it.
So I will save in the backend only the path of this image.
I tried to search how to move or copy an image in a folder, but I haven't found any solution.
How should I do this?

How should images be saved using express? Database, or just file?

I am using basically the mean stack. I'm also using multer but I am trying to see what the best practices are. Using Angular I can upload photos fine and they are going to a folder on my file system. From here I can just view them. However I'm wondering what the best practices are. Should I save the image url to a database along with the size and other properties or should I just pull them from the client? I've seen some solutions but they were from about 2 years ago so I wanted to make sure I'm current.
I have used ng-file-upload upload on the angular part and Multer on the node.js part to handle images for my system.
The method is appropriate and you can go ahead without any doubt.
Most of the websites on the internet follow the same method, they save the images in the file disk system and then they save it's url in the respective database.
Using multer you can have all information required for a photo and the module is really flexible with a lot many options.
I think you should go ahead with what you have in mind. Best of luck.
You just save the image url from the directory, where image is stored. If you need any information, you can get the information from the image where image is stored (Get image from url). So just save image url into database.

Resources