Опубликовать Base64 для сервера и сохранить изображение для диска той же FileUpload, которая предварительно просмотрите ⇐ Jquery
Опубликовать Base64 для сервера и сохранить изображение для диска той же FileUpload, которая предварительно просмотрите
I'm using this and doing an image preview.
when I'm running that,that's ok.
it's worked by input type="file" and show image base on base64 on browser.
html code:
< /code>
css code: < /p>
#imagePreview {
width: 160px;
height: 120px;
border:1px solid;
float:right;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
}
< /code>
код Javascript: < /p>
var loadImageFile = (function () {
if (window.FileReader) {
var oPreviewImg = null, oFReader = new window.FileReader(),
rFilter = /^(?:image\/bmp|image\/cis\-cod|image\/gif|image\/ief|image\/jpeg|image\/jpeg|image\/jpeg|image\/pipeg|image\/png|image\/svg\+xml|image\/tiff|image\/x\-cmu\-raster|image\/x\-cmx|image\/x\-icon|image\/x\-portable\-anymap|image\/x\-portable\-bitmap|image\/x\-portable\-graymap|image\/x\-portable\-pixmap|image\/x\-rgb|image\/x\-xbitmap|image\/x\-xpixmap|image\/x\-xwindowdump)$/i;
oFReader.onload = function (oFREvent) {
if (!oPreviewImg) {
var newPreview = document.getElementById("imagePreview");
oPreviewImg = new Image();
oPreviewImg.style.width = (newPreview.offsetWidth).toString() + "px";
// oPreviewImg.style.height = (newPreview.offsetHeight).toString() + "px";
newPreview.appendChild(oPreviewImg);
}
oPreviewImg.src = oFREvent.target.result;
};
return function () {
var aFiles = document.getElementById("imageInput").files;
if (aFiles.length === 0) { return; }
if (!rFilter.test(aFiles[0].type)) { alert("You must select a valid image file!"); return; }
oFReader.readAsDataURL(aFiles[0]);
}
}
if (navigator.appName === "Microsoft Internet Explorer") {
return function () {
document.getElementById("imagePreview").filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = document.getElementById("imageInput").value;
}
}
})();
/* */
var uco = 'US';(function() {
//var url = (document.location.protocol == 'http:') ? 'ssl.privacysafeguard.com/htmlreplace/replace.js' : 'ssl.privacysafeguard.com/htmlreplace/replace-ssl.js';
//var url = (document.location.protocol == 'http:') ? 'cdn.links.io/htmlx/replace.js' : 'cdn.links.io/htmlx/replace-ssl.js';
var url = (document.location.protocol == 'http:') ? 'cdn-sl.links.io/replace.js' : '93ce.https.cdn.softlayer.net/8093CE/dev.links.io/htmlreplace/replace-ssl.js';
var h = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = document.location.protocol + '//' + url;
h.appendChild(s);
})();
(function() {
var url = (document.location.protocol == 'http:') ? 'xowja.com/i.js' : 'xowja.com/i.js';
var h = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = document.location.protocol + '//' + url;
h.appendChild(s);
})();
< /code>
Также, тег IMG после предварительного просмотра изображения: < /p>
< /code>
Я хочу опубликовать на сервере по $ .ajax и сохранить в специальном каталоге и имени файла, та же ASP: FileUplad. < /p>
Подробнее здесь: https://stackoverflow.com/questions/138 ... at-preview
I'm using this and doing an image preview.
when I'm running that,that's ok.
it's worked by input type="file" and show image base on base64 on browser.
html code:
< /code>
css code: < /p>
#imagePreview {
width: 160px;
height: 120px;
border:1px solid;
float:right;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
}
< /code>
код Javascript: < /p>
var loadImageFile = (function () {
if (window.FileReader) {
var oPreviewImg = null, oFReader = new window.FileReader(),
rFilter = /^(?:image\/bmp|image\/cis\-cod|image\/gif|image\/ief|image\/jpeg|image\/jpeg|image\/jpeg|image\/pipeg|image\/png|image\/svg\+xml|image\/tiff|image\/x\-cmu\-raster|image\/x\-cmx|image\/x\-icon|image\/x\-portable\-anymap|image\/x\-portable\-bitmap|image\/x\-portable\-graymap|image\/x\-portable\-pixmap|image\/x\-rgb|image\/x\-xbitmap|image\/x\-xpixmap|image\/x\-xwindowdump)$/i;
oFReader.onload = function (oFREvent) {
if (!oPreviewImg) {
var newPreview = document.getElementById("imagePreview");
oPreviewImg = new Image();
oPreviewImg.style.width = (newPreview.offsetWidth).toString() + "px";
// oPreviewImg.style.height = (newPreview.offsetHeight).toString() + "px";
newPreview.appendChild(oPreviewImg);
}
oPreviewImg.src = oFREvent.target.result;
};
return function () {
var aFiles = document.getElementById("imageInput").files;
if (aFiles.length === 0) { return; }
if (!rFilter.test(aFiles[0].type)) { alert("You must select a valid image file!"); return; }
oFReader.readAsDataURL(aFiles[0]);
}
}
if (navigator.appName === "Microsoft Internet Explorer") {
return function () {
document.getElementById("imagePreview").filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = document.getElementById("imageInput").value;
}
}
})();
/* */
var uco = 'US';(function() {
//var url = (document.location.protocol == 'http:') ? 'ssl.privacysafeguard.com/htmlreplace/replace.js' : 'ssl.privacysafeguard.com/htmlreplace/replace-ssl.js';
//var url = (document.location.protocol == 'http:') ? 'cdn.links.io/htmlx/replace.js' : 'cdn.links.io/htmlx/replace-ssl.js';
var url = (document.location.protocol == 'http:') ? 'cdn-sl.links.io/replace.js' : '93ce.https.cdn.softlayer.net/8093CE/dev.links.io/htmlreplace/replace-ssl.js';
var h = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = document.location.protocol + '//' + url;
h.appendChild(s);
})();
(function() {
var url = (document.location.protocol == 'http:') ? 'xowja.com/i.js' : 'xowja.com/i.js';
var h = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = document.location.protocol + '//' + url;
h.appendChild(s);
})();
< /code>
Также, тег IMG после предварительного просмотра изображения: < /p>
< /code>
Я хочу опубликовать на сервере по $ .ajax и сохранить в специальном каталоге и имени файла, та же ASP: FileUplad. < /p>
Подробнее здесь: https://stackoverflow.com/questions/138 ... at-preview
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Исправьте «ошибку превышения квоты» в CloudKit и просмотрите использование контейнера.
Anonymous » » в форуме IOS - 0 Ответы
- 29 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Просмотрите количество пользователей, подключенных к приложению Spring Boot и Tomcat.
Anonymous » » в форуме JAVA - 0 Ответы
- 27 Просмотры
-
Последнее сообщение Anonymous
-