Tutorials to .com

Tutorials to .com » Database » Sqlserver » Do not, upload ago, at the client to determine the size of image files

Do not, upload ago, at the client to determine the size of image files

Print View , by: iSee ,Total views: 15 ,Word Count: 246 ,Date: Tue, 25 Aug 2009 Time: 4:07 PM

Do not, upload ago, at the client to determine the size of image files

Was previously collected TIPS, recently used in the project, and it may be helpful.





"! - Taken from the 51js ->

<script>
var img = null;
function s ()
(
if (img) img.removeNode (true);
img = document.createElement ( "img");
img.style.position = "absolute";
img.style.visibility = "hidden";
img.width = 0;
img.height = 0;
img.attachEvent ( "onreadystatechange", orsc);
img.attachEvent ( "onerror", oe);
document.body.insertAdjacentElement ( "beforeend", img);
img.src = inp.value;
)
function oe ()
(
alert ( "cant load img");
)
function orsc ()
(
if (img.readyState! = "complete") return false;
alert ( "image size:" + img.offsetWidth + "X" + img.offsetHeight);
alert ( "Image Size:" + img.fileSize);
btn.disabled = false;
)
</ script>
<input id=inp type="file">
<br>
<button onclick="s()"> Test </ button> <button id=btn disabled> UpLoad </ button>

We can see that, in fact, very simple, it is first defined in memory, a IMG object, and then use this object on the client the various properties of the object to be IMG.


Microsoft SQL Server Tutorial Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.