На страничке необходимо загрузить в input type file, а так же вывести эту картинку в img. А далее ajax запросом передать base64 строку на сервер и там перевести её в массив байт. Вот мой код View:
$('#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();
}
Но при попытке конвертации вылетает ошибка с текстом:
Входные данные не являются действительной строкой Base-64, поскольку содержат символ в кодировке, отличной от Base 64, больше двух символов заполнения или недопустимый символ среди символов заполнения
Хотя если использовать сайт для перевода base64 в image https://codebeautify.org/base64-to-image-converter конвертирует нормально.
Если нужен будет пример base64 кода напишите я приведу. Просто он очень большой. Могу привести например начало и конец кода, по моему по ним определяется подходит он или нет. Ну вообщем если нужен будет пример, приведу. Не понимаю почему c# не конвертирует.
Очищенная строка:
:/;,////+/++++++/+///////+++++///++/+/++/+/+/+/+/+////+++//////+///+/+/++++///+/+++//+/+//+++/+/+++++/++/++++/++++//+//+++++//+/++++++++++/+/+//+++/++++++//++++/+/++++//+/+++///+++/++++/++/+///+++/++/+++++/+/++++++//////++//+//+///++++++/++++/////+++++///+/+/+///++++//+/+/++////++/++/+/++/+///+/++/++///++/////+/+//+//+++//////++//+/++////+++//+//++++/++/+/+/+/++/++++++++//++/++++++/+/++//++++++/+/+++++++/+///+++++//+/++++/++///++////+/+++/++++++/++/++++/+/+///++//+//++/+/++/+++/+++/+/++///+/++/++//+++/+/+//++/+++/++/++/+//+/+/+///++///++/+///++/+++//+/+//+//++/+/+++/+++++/++/+/++///++/+/++//+/+/++//+//++++/+///+/+//++++/+++////+//++/++/++/+//+/++////+/++//++/+++//++++///++++//+///++/////++///+///++/+/++/++++++/+///+++////++/+++/++///+/+++++//++/++/+/+++++++++++///+//++/++/+++/++/++++////++++/++++/+///++///+//+++/++++/++////+//++++/+/++///++++/++/+++///+++/++/++++/++///+/+/+++///+++/++//+/++/++++++////+/+/+////////+/+//+////++/++++////++++//+/++//+/++/+//+/++//+/++/++//++++/+/+++////////+++/++/+++++/+/++/+//+/++/++++/++///+/++++////+/+/++++++++/++/+//+/+/////+//////+/++++///+/////++++++/++/++/++///+++++++++/++/++/+///+//++++//++////+/++/++//++/+/+/++/+++/++////++///+/++++//+++///+++//+/+/+++++/+//+/++//++///++//+/+++/+////++/+++/////+++/++++//+++//+++//++//+++//+/+//++/++//+/+++//++++///+++/+////+//++/++/+//+//////++/////+++/+//+++++++////++/++//++++//++++///+///+////////////+//+///+///++/+//+++//++++++/+/+/+/++/++++/+/+////+/+/+//+//////+///++///////++//+///++/+++++//////+////++/+//+//+++//+/++//+/+/+/+///++//++/++/+/////++++/++++/++////////+///////+++/++/++//+++////++++/+//++++++++//+++///+++++++++/+/+++//+//++//+/////+///+++//+/+/++/++++//++/+///+///+++//+/+/++///////++++++++++//++++++//+++++//+++++++++++///+////+++/++/+++//+/++++//////////+/////++++++/+/+/++/+++/////++//////+//++/+//+///+++///++///++//+++//+//++//+//+//+///+++/++/////++++///++//++///+++/+///++++//++++/+++++/+///+/++//+//++/+/////+++++/+/++/////+//+/+/++/+/+++++++++///+/+/++/+/+///+++/////+/+/+/+//+++++++/++/++//+////+/////+/++++++/++//++/+++//+/++++/+/+++//+++++/++++//+//++//+///+++/+++++/////++//++++/++++++//+///+/+/++/+++///+//+++/+//++/+/+++//+++/+/+++/++/++/////+++/++/++//++/++++///++++///+++//+/+++++++++++++///+/+//+//+/+///+//+/+++++//++//++++++++//++//+/////+/++//+/+/+/+//++/////+++////+//++++//+/////+++/+++++////+++/+///+/+/+/////+///+/+/+++//+++//+/+/////+++++/+//++/////+/+++++/++//+/+++//++////++++//+/++///+/+/+////++/++++//+/+/////+++/+/+//+++/++++++++/+///++++/+////+++//++/++//+++/+/+///++//++/////+/+//+++++/+///+/+/+/+++/++/+/////+++++/+/+/+//+//++/+/++///++//++++++/+++++//++//+/++/+///+//+++//+++//////+//+//////+/++///++/+//++///+/+//++/+++//////+++/++++///////++///+++///+/////++//++++++++/+++/+/////+///++/+++/+//+++++///+++/+//++/////++++///+/+++//+++///+//////+/+/++///++/+/++///++///////++//++//+++/+/++/++/+++/++///++//+/+/++/+/++/+//+++++/////+/+/////+++/+/++//+/+/+//+/+////++/+///+//+///+/++///+/+/+///+///++++++/////++/++/++/++////+///////+/+/+//+++/+///+//+/+/++/+///+///++/+//////++++/////++/++/++///++////+///++//+/++////++/++/+/+////+++++++++/+/////+//+//+/////+++/+++/++++//++///+//+++++//+/+/++/+/++///++////////+////+/+/+/++////+/+/+//+/+///+++/////+++//+////+/+++/+//+//////+///++++///+/+///++/++/++/+++//++/+++/++//++///++/+////+/////++/++//+////////++++///+++//+/+////////+/+//+++/+++/////++/+++/+/+///++//+++////++/+/+//++++//+/+++/+//+//+///++/+/+///++///++/++//++++++++//+//+///+++//////+++//+////+/+//+///++/+++///++++/+/+/+++/+//+/////+/+/+++/++++++++//++++/////+/////++/+++//+++//+/++++++/+////++//++/++++/+++++//+////+/+/+/+//++++/++++++/+///+/+////+++/+++++/++//+//+/+++//+/////++/+/++++/+//+////+/+++/+++//+/+//++/+//+/+/////+///+/+////++//+///++++////+/++//+///+/+/+//+/+++++//++++++//+/+//+/++/+///+//++//+/+/++///+///++////+++++++//+//++/+///+++//+/+/+/+///++/+//+//+++++//////////++////+++///+++/++++++++++++++++/++/+//++++///+/+///++/+/+/++/++++/////////+/++++/+//++++++///+///+++/++/++/+/+//++///++/+/+//+++++/+/+/++////+++/++/+/++/++//+/+/++///+++//+//++/++/+++++++///+/+++///+///+/+/+++/++/+////+++/////++//+/++/+/+//+//+/+///+++++++//++++/++//+//+/+//++//////+++//+++//+/++//+/++++/++/+++/+/++++/+////////++++++//+/+/+///++++///+/+++/++///+/+///+//+++++//++/+////+/+++////+++++/+++/++////+++///+++////+//+++/+/+/+///////++/++//++++/+/++/////////////+///+//++/++///+/++++/++//+//++/++++/++++++///++//+///+///+/+++/+///++////++/+++++/+++/+/+/++++/++///+//+/+////++++//+/+////+++/+++/++/+++//++++++/////+////+//+//+++//+//////+////+++//+/////+//++/+++/+//+/+++++/+++/+/++/+/++++//+++++++//+///++/++++////++/+++/++++/+/+//+++//+///+/++++/++///++/+/+/+//++++++/++///+/+++/+///+//++/++/++/+/+//++/+//++/+++++/+/++//+/+/////+/+//+++++/+///+/+//++/++/++/++////++++//+/+/+++///+//+/+++++/+++/+/++++++/+/+///++++/++///++///++/++++//++++/////++/++++++/++/+++/+//////+/+++++///////+++//++/+//++/+///+//++/+++++///////+++++/+/++++/+++/+//+//++++//+/+//////++/+/+/+/+//+/+/+//+/++/++/////+//+++/++//+///+++/++//+////++++//+//+//+//+++++++/+/+//++/++//+//+//++++//+++//+/////++++///++//++/+/+++/+++/+++/+//+/++++++++++/+/+++/+//+/++/+++++//+/++/+++/+++//+/////++//++/++/+++////++++/++///+/+//+/////+++//+/+++///+/++/+/++++//+/+/+/+//++++/++//+++///+//+//+////++/+/++///+/+////++++//++/+/+///////++++++/++/++++/+++++/++/++/+++/+//+/+++//+/+///+/+///+++/+/+++/+/+/+/+//+//++/+++++++++/+/+/+++//++/+++++/++++/+/+++//++++/+/+/+/+/+///+//+/+++/+/+/++//++++++//+++++++/+/+///+++++++/++/+++++//////+++/++////////+/++++++/+/////+/++////+/+++/+//+/+/++///+++/+/+++++++/++////++/+/++++++//+///++++/+++++///++/+////+//++/+//++++++////++++/+++/+//+//++/+/++++/++//++++/++++//+++////////+//+/+++++/++++//+/+//+/++++///+//+/++/++////+/++++//+///++//+///++////+///+/++/++///+++++//+++/////+/+/++++++/+/+++///++//+//+///++/+/+++++///+//++//+//+///++/+++//++/++/+/+/+++///+++++//+//+++///+//++++/+/++/+//+/++/++////+/////+++/++++/++++//+////++/+++///+/+//+/+++///+//+++/+//+/++/++/++///+++/+++/++/++/////+/+///+//+++//+++/++++/+//////+//+++////++////+/////////+/+/+++/+++/+++/+/+/++/+/////++++++/+++++++++//+//++////++//////++//+/+//+/+/+/+///++/////////////+///++++++///////++/++///////////+/++/+++/+//+++//++++//+//////++//++//++++/+//////+/++/++++//+/////+/////////++///+////+++////////++//+++////+//+//++/++//////+///////+///++++////++///+++++///+////+/+/++++++//++++/+/+/+/+++////+//++///+/++///++/+/++///+///++////++////////++////+//+++/+/++/+/++/+/+/+++/+//++///////+////+////+++//+/+/////+++//+///+//+/++//+++//+//++/+///+/+/////++/+++/+/////+++////+//++/+/+//+///+/////+//+/++////////////++/////+//////+///+//++//+///////////////+//+//+++/+////////+//+//+++/+//+//++//++///+////+///////+++////+++//+/+//++++++//+/+///+//+///////+/+///+/+++////+///++/+/+//++/++++//+//+////+///+//++/+/+/+/++///+/////+//+/+////+//+///+/++/++/+/+//++/+/+///+++/+//++///+//+++//+++/+//++++/////+++//////////+///++/+///+//++/++/+/+////////////+//+/+++/+/////+/++///////+///++//++///+////+/+/+++//++//++/+///+/+/+//+///+++//////++/////+/+++//+////////////+/////////+++////+//+/+////+//+/+//////////++/+///+////+////////++////+/////+/+++//////+////++/////++/++/////////+/+//+//////+///+//+/++/+/+++///+///////+/+/++/+/+++///+/++/++/+//+/+/++/+/++++////+++/++//+/+//+///+++///++/+///++/+/////+/++++/+++//+/+//++++//+/+/++////+/++++//+/+++//+/++++///++////////+++/++//++++++/////+//+/+//+////+++//+++++++++/++++/+++++/++/++/+++/+/+/+//+++////+/++//+//+++++///++/+/++//+/++/++/+/+//+++///+++++/++/++++/+++/+++++/+++//+/++//+++++/+///+++/++/+++//+++/++/+++/+++++///++/+++/+//++//++//+++/+//+/++++/++/+++++++/+/+++/+/+++/+/+//+///+++///+++++++++/+++/++++/+////+/+++//+//+++/+//+/++++//+/+/+/++/+/+/+/++/++++//+++/+///++/+//+//+/++++//++/+///+/++++///////++/+//+/++++++//++//+/++++/++/+/+++//+//+++//+///+//++//+//+/++++//+///+++++++//+//+/+++++//+++//++++//++/+++/++///+++++///++/+//+++/+/++++++/+/++//++//++/+/++////+++++++/+/+++++//+/+/++++//++++++/+++////++/+//+/+/////+++//++/+////+//++/++/++++/+///+//+++++/++/++///+++/+/++////+//++/+/+/++/++/++++++/////+//+//+//++/+///+++/++//++///++++//++//++++/+++///+/++/+++////+//+//+//+/+++++/++///+/++/+///++++++++/+++/++//////++///+/+++/++/++////++/+++/+/++++//+/++++/++++///+//+/+/+/+/++++/++++//++++/+++/+/+////+++++/++++//+//++++/++//+++//+++++///+++///+///++/+++//+/++/++/+///+/+/+/+/+++/+///+/++/+++++++++//+/+/++++++++//+++///+//+/+/+//++////+++//+/+/+/++++//+/+/+++///++++++/++/+++//+/++///+/+++++++/+////++//++/+++///+++/++///+++//+++/+++/+/++++++/++++++++/+/+//+/+///+/++/+/+/+++//+/+//+/+/+/++++++++++++/++/+/++/+/++++++/+/+++/+++++++/+++/++/+/+//+/+/++/++//////+/+/++/+/+//+/++//+/++++/+++/++//++/+/++/++++/++//++++/+///+++/+++++++/+//++++/++///+//++/++++/+//+//++/+++///++/+/////++/+++++/++++++/++///+/+++/++/+/+/++++/+++++++/+/+/++/+/++++++/++++/+/+++++//+++/+++////++/+++++/+///++///++//++/++++//++/++++++//+++++/++++++++/+/+//+///+++++/+++//+/+++/++/+/+/+/+/+++++/////+/++/+/+++++++++++++++++++//////++/++++/++++++//+/++++++++++/+++/+/++++/++++/+++///+++/+/+/+/+++++//++++//+/++//+/+////+/+/+///+++//////+++/+/+////++++++++/+++///+/+/+++/++++//+++/////////+///+/////+////////++////+/////////+//++//+/+/++////++++////+///++//+///+///+/////+/++//+//+////++++///+/++/++/++/+/+///++/+++/+/++///++//++/+///////+//+/++//////+/+//+/+/++///+++++//+//////++/+/+///+/+++//+/+/////+++//++/++////+++//+++++/++////+//////+++/++++/++++++++/++++////+//+/++////+////+/+///+////+/++/+//+++///+//+///++//++////++//++/+/+//+++/++++/+/++++//+/+//+///++/+/+/+//+//++//++//+/++///+/+/+/+++/////+/+/++///++++/+/+/+///+++++/+//+//+/+/++//++/+/+//+///+//++++++++/+//+//+/+//++++/+/+++//+++++++/+//+/++++/+/+/+/+//+/++++//+//++++++/+///+/+++/++///++///+++//++/+/+/+/++/++++/+/+++/////+/++/+//++++/+/++/+/++++//+///++/+/++////+/+///+++++++/++/++//+//+++/+/+++///++++/++++/+++/++/+/+/+//+/++/++//+//+//+/++/+/+/////+++//++/////+/+//+/+//+/+/+//+//+/+///++//+/+++++/++//+/+++//////++////+//+/++/+++//+///+//+/+++///+//////////+//+///+//+/++////+/+++///+/+//+/++/+++//++///+///++//++///+//+/+//++/+///+///+++//+/++///+/+//+///+//+++++++/++//++/++/+///++++/++/+////+//++/+//////+/+++/++/++//+//+++//+//++//++++++/+/++++/++/++++////+++/+////++///+++++++/+/+++//+++////++/////+//+++/++++//+///+///+++/++/+/+/+/+++/////+++//++///++/+//+///+/+///++/+/++++/+///++///+/////+///////+/+/+++////++//++/+////+++///+/+++//++++/////+///////+/++//++/+/////+/++++/++//++/++//+/+/+//+//+/+++//+/+/+//////+//++/++/+////+///++//+//+/////++/+//+//+//+///++/++///++//++/+///++////++/++/////+/+//////+++//++//+/+/+/+/++++/+/++/+/++//////+//+//++//+/+/+++/++/////+/+/++/++/+/+//+/+++/+/////++/++/+/++//+//+//+++++++/+/+/++//+//+++/+////++//////+/+/////+/+///+/+++////+/++/++/+//+++++/+////+///+////////+/++//+++//////+/+++//////////+/++/++/+++++//+////+/++///+/+++++/+/+/++/+//+///+/++/+/////++///++///+//++/+/+/++/+/++/////+//+/+////+++///++//++///++///+/+/+//++/+///+/+++//+++/++////++/+/+/++++//++//////+++///////+///+///////++++/+////+//+/////++/++++/++++/++//++/+++//+/+/++/+/+++/++/////+/+/+/++///+++/+++++/+/+/++/+///+++/+++/++++//+///+++++/++/+/+//+//++++/+/++///+//+/++/+////+/+///+/++++////////////+//++//++++////++//+//++//+/+++/+/+/+/+/+//++++/+++/+++++//++/++++/+++/+/+//++////+++++//==
Виртуальный выделенный сервер (VDS) становится отличным выбором
Нужно в аяксе после успешного ответа от сервера показывать кнопку для сохранения приложения на рабочий столСделал динамический манифест...
Что имею: n-ное количество переменных (500-2000), которые достаю из базы и передаю в нужный мне `, созданного при помощи плагина Chosen:
Я создаю кнопку на карте с помощью следующего кода:
Мне необходимо хранить в БД адреса и контактные данные людей (телефон, email, ФИО, паспортные данные)Я не очень силен в теории РСУБД, но хочу все...