-->

Is it a good practice to save a base64 string on t

2020-08-12 06:45发布

问题:

i'm developing an android application when the user can send a image to my webservice.

Currently on my WebService i get a Base64 string and save it in a table on my database.

My question: Is that a good practice? Because as far as i know the Base64 string is a heavy string. My concern is about the db performance, like when this table gets bigger than 10000...100000 records.
Or should i avoid this behavior?
Eg.: Isntead off store the Base64 string on the database, i could recover the image and save only the URL at my db.

Ps: The database is SqlServer


Thanks for the help guys

回答1:

To answer your question, I think it's not good practice.

It depends largely upon how you will use these images you will probably load. Then, remember (base64 encoding makes file sizes roughly 33% larger than their original binary representations). The best way would be writing the image and then saving its location in the database.

Check out this post as it maybe help.



回答2:

i think using base64 encoding is very useful for saving URLs in the database. The big size for transmitted image is not good idea and not necessary.