I am having trouble researching or trying to figure out how (if possible) to get binary image data using JavaScript / jQuery from an input element of an html file of type.
I am using WebMatrix (C #), but it may not be necessary to know what if the objectives of this question can be solved using only JavaScript / jQuery.
I can take an image, save it in a database (as binary data), and then show pic. on the page, from binary data, after publication. This, however, leaves me without a pic preview before downloading, for which I am pretty sure I should use AJAX.
Again, this may not even be possible, but so far I can get the binary image data, I believe that I can send it to the server using AJAX and process the image in the same way as if I took it from the database (note that I do not save the image files themselves using the GUID, and all this, I just save the binary data).
If there is an easier way to show a pic preview with an input element, this will work fine too, since the whole idea behind me trying to do this is to show a pic preview before they get to submit (or at least create an illusion).
********** UPDATE ***********
I do not consider this a duplicate of another question, because my real question is:
How can I get image data from an input type file using JavaScript / jQuery?
If I can just return the data (in the correct format) back to the server, I have to work with it there, and then return it using AJAX (although, I'm absolutely not an AJAX expert).
According to my NO WAY study, to get a preview of images in all versions of IE using only javascript (this is because viewing the full path to the file is considered by them as a potential security risk). I could ask my users to add the site to reliable sites, but you usually donβt ask users to change these settings (not to mention the fastest way to make your site suspicious for users, by asking them to directly add your site to the list of trusted sites. It's like sending an email and asking for a password. "Just trust me, Iβm sure of security!" :)