Click here to Skip to main content
15,903,012 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear,

In java script how to Image convert into conten bytes and save in sql.

I have data type is image in sql.

It this possible.

Thanks
Basit

What I have tried:

I tried to convert image to base64, but the disadvantage is size is too big 3 or 4 time from actual image.
what i want how we are using in asp.net to sql save image as content byte.
Posted
Updated 17-Apr-16 19:49pm
v2

1 solution

Quote:
I tried to convert image to base64, but the disadvantage is size is too big 3 or 4 time from actual image.
Base 64 encoding well done is 1.33 (4/3) from actual size.
You should show how you doing your encoding.

Base64 - Wikipedia, the free encyclopedia[^]
 
Share this answer
 
v2
Comments
basitsar 18-Apr-16 1:54am    
Dear,
Below is the code to convert image to base64
Public Function ConvertFileToBase64(ByVal fileName As String) As String
Return Convert.ToBase64String(System.IO.File.ReadAllBytes(fileName))
End Function
Patrice T 18-Apr-16 2:04am    
Can you show a sample of your base64 encoding ?
basitsar 18-Apr-16 7:00am    
with the help of below code convert image to base64

Public Function ConvertFileToBase64(ByVal fileName As String) As String
Return Convert.ToBase64String(System.IO.File.ReadAllBytes(fileName))
End Function

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900