From: Taras Koval Date: 2007-07-10T18:42:22+09:00 Subject: Re: Get file size before download (noobish question) Shai Rosenfeld wrote: >>> For IE: >>> >>> function getFileSize(file) { >>> var oas = new ActiveXObject("Scripting.FileSystemObject"); >>> var e = oas.getFile(file); >>> var f = e.size; >>> return f; >>> } >>> > > ... as of uploading: > > how do i use this function? i want to check out the file size before > allowing the user to upload a file or not (essentially, i should be able > to limit file size uploads from lighttpd [which is what i am running] > but i couldn't seem to find any doc on how to do it) so i'm thinking of > sending an ajax request to see what the file size of the upload is, and > then pass the upload, if it is the right size. > > the script above seems quite handy for this purpose (btw, this works > only for IE?) > but i don't know what needs to go into the 'file' parameter ... i tried > supplying a path to the file on my system, for a check > "getFileSize('/home/shai/test.size') " but that didn't work .. what > parameter am i supposed to supply to the function? > > tia... > > shai > > Example: