samedi 4 avril 2015

Retrieve an image from the server using asp classic

i found this code to read image through ajax, can anyone please tell how to do it with asp classic instead of php?



function LoadImg(filename) {
var xmlhttp;
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("documentHolder").src = "data:image/png;base64," + xmlhttp.responseText;
}
};
xmlhttp.open("GET", 'load.php?LoadImg='+filename );
xmlhttp.send(null);
}

<?php
if (isset($_GET['LoadImg'])) {
header("Content-Type: image/png");
$file = file_get_contents($_GET['LoadImg']);
echo base64_encode($file);
}
?>

Aucun commentaire:

Enregistrer un commentaire