Convert image to base64

I'm trying to convert an image into base64 using javascript, however if I request the URL with jquery, and encode with javascript, the results are different than what I receive from here (http://www.scalora.org/projects/uriencoder/) when saving and uploading the image..

Is there any reason for this?

I'm just using $.get and base64 encoding function data()

Answers


Another SO Question covers this exact topic and has a solution that works for IE and Firefox. The short answer is that XHR really isn't designed for binary data and the data gets corrupted or truncated when converted to a string for XHR.responseText.

It would be best to Base 64 encode on the server side.


Need Your Help

iOS Recognize that a touch was made but don't intercept it

iphone ios uikit uigesturerecognizer uiresponder

I have a view that I am showing. The view appears on the same screen with UITableView. I want to dismiss the view when anywhere on the screen is touched, but I don't want to prevent that touch from

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.