Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('#modalWindow').on('click', '#send', function () {
- $.ajax({
- type: "POST",
- url: "/Home/LoadImage",
- data: {
- "base64img": $('#autoPicture').attr('src')
- },
- success: function (data) {
- alert('Привет');
- },
- error: function (error) {
- alert(error.responseText);
- }
- });
- });
- $('#modalWindow').on('change', '#fileLoader', function () {
- ReadImageUrl(this);
- });
- function ReadImageUrl(input) {
- if (input.files && input.files[0]) {
- var reader = new FileReader();
- reader.readAsDataURL(input.files[0]);
- reader.onload = function (e) {
- $('#autoPicture').attr('src', e.target.result);
- }
- }
- }
- [HttpPost]
- public ActionResult LoadImage(string base64img)
- {
- byte[] picture = Convert.FromBase64String(base64img);
- return View();
- }
Add Comment
Please, Sign In to add comment