Hello all,
I let the users to upload files and not only images. I want before the file upload to check the size of the file.
I now how to do that with images but not with files.
Does any one have an idea?
Thanks
[CODE]<HTML> <Head> <Script type="text/javascript"> function getStats(fName){ var fullName = fName; var shortName = fullName.match(/[^/\]+$/); document.Form1.dispSize.value = fileSize(fullName); document.Form1.dispName.value = shortName; } </Script> <Script type="text/vbscript"> Function fileSize(fileSpec) Set fso = CreateObject("Scripting.FileSystemObject") Set contentFile = fso.GetFile(fileSpec) isSize = contentFile.Size fileSize = isSize Set contentFile = Nothing Set fso = Nothing End Function </Script> </Head> <Body> <Form name='Form1'> Choose a file: <input type='file' onchange="getStats(this.value)"><br> File Name: <input name='dispName' size='20'><br> File Size: <input name='dispSize' size='10' readonly><br> <input type='reset'><br> <input type='submit' value="Submit"> </Form> </body> </html>[/CODE]
Help @noamway spread the word by sharing this article on Twitter...