côté client, JS n'accède qu'au chemin+nom
img = new Image(); img.src = chemin_fichier; img.onload = function() { alert(img.width+" X "+img.height); }
document.getElementById('mon input').value
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <head> <style type="text/css"> .box{ position:absolute; background-color:gray; height:200px;width:250px; margin-top:120px; margin-left:600px; border:1px ridge #aaa; -moz-box-shadow: 10px 10px 10px #212121; -webkit-box-shadow: 10px 10px 10px #212121; box-shadow: 10px 10px 10px #616161; } table td{ border:2px; border-style:solid; } </style> <script type="text/javascript"> function dragenter(e) { e.stopPropagation(); e.preventDefault(); } function drop(e) { if (!e) { var fichier = document.getElementById('fileinput').files; } else { var fichier = e.dataTransfer.files; } document.getElementById('nbfic').value=fichier.length for(var j=0;j<fichier.length;j++){ var tbrow=document.getElementById("tabs").insertRow(-1) tbrow.insertCell(0) var zozo=document.createTextNode(fichier[j].size) tbrow.cells[0].appendChild(zozo); tbrow.insertCell(1) var zozo=document.createTextNode(fichier[j].name) tbrow.cells[1].appendChild(zozo); tbrow.insertCell(2) var zozo=document.createTextNode(fichier[j].type) tbrow.cells[2].appendChild(zozo); } } </script> </head> nbr de fichier taille de fichier, nom de fichier, type de fichier </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <head> <script type="text/javascript"> function chacharge(){ if(document.all) { var filename = document.getElementById('hiddenfile').value; var Img = new Image(); Img.src = filename; document.getElementById('mon_image').src = Img.src; } else{ var fichier = document.getElementById('hiddenfile').files; var charge=new FileReader(); charge.readAsDataURL(fichier[0]); charge.onload = function(e){ document.getElementById('mon_image').src = e.target.result; } } } function getfile(){ document.getElementById('hiddenfile').click(); } </script> </head> </html>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question