Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

From a client (browser), using javascript I want to send an image to sql server ( and store with user profile) (sql server), along with other data such as user id or name.

Which option is better? Send image as img / jpg? Or convert it to base64 and send everything as json format?

share|improve this question
What does the database have to do with it? – tdammers Apr 20 '13 at 19:14
The image will store later in a database, and sending format depending guess the store directly as base64 (in an nvarchar field) or jpeg (in a field image). The question I have is whether it is worth converting jpg / png to base64 or better send it directly as an image. – aelbaz Apr 20 '13 at 19:17
I think it is best to store an image on a file system instead of a database. – Akshat Jiwan Sharma Apr 20 '13 at 19:40
* edited your question, might be more clear * you are mixing up areas. a web app has many parts. one is the front end, then the business logic and then the back end data base (if not more mid tier). do you have 2 questions: 1 get image from client to web server and 2 how to store. google these two and you will have answer – tgkprog Apr 20 '13 at 20:23
i do not think you can read an image in java script. you can make an iframe, upload it, after a user signs up ... store in the db or file system with the user id. if you have only one node (server computer) file system is okay, with many nodes need a way to sync between nodes. db + file system is an option too. on file system make nested folder. like usrs/1/11 for users whose ids start with 11 ... – tgkprog Apr 20 '13 at 20:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.