By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,943 Members | 1,890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,943 IT Pros & Developers. It's quick & easy.

how to set selected image from brwose button into bytes

P: 1
my doubt is i am seleected image from browse button before submitting image is converted bytes.So back end it stores like string. In my js function i wrote below code.If i submit its converts into bits,i want byte information.That byte information how can i set spring mvc controller.

Please help me.

Expand|Select|Wrap|Line Numbers
  1. function readURL(input) {
  2.             if (input.files && input.files[0]) {
  3.                 var reader = new FileReader();
  4.  
  5.                 reader.onload = function (e) {
  6.  
  7.                     b= e.target.result;
  8.              alert("The Target file is : "+ b );
  9.  
  10.  
  11.  
  12.                $('#blah')
  13.                         .attr('src', e.target.result)
  14.                         .width(100)
  15.                         .height(150);
  16.                  //alert('byte data is'+a);
  17.                  //alert('.........'+src); 
  18.  
  19.                   //var a=$('fileUpload').val();
  20.  
  21.                 };
  22.  
  23.                 reader.readAsDataURL(input.files[0]);
  24.             }
  25.         }
Apr 4 '16 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
you canít. at least not in JavaScript.
Apr 4 '16 #2

Post your reply

Sign in to post your reply or Sign up for a free account.