File Size
-
Hi, I am using File Upload control to upload files. Is there any way to find the size of the file before saving it. Because I want to tell to the end user that 'ur File size exceeded the max limit'. Thanks Hari
FileUpload1.PostedFile.ContentLength
?All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
Hi, I am using File Upload control to upload files. Is there any way to find the size of the file before saving it. Because I want to tell to the end user that 'ur File size exceeded the max limit'. Thanks Hari
use this : 'flUpload is the name of File Upload control
flUpLoad.PostedFile.ContentLength
it will return the size of posted file in bytes... :)Arun Singh Noida.
-
use this : 'flUpload is the name of File Upload control
flUpLoad.PostedFile.ContentLength
it will return the size of posted file in bytes... :)Arun Singh Noida.
-
Thanks, Is there any way to find the same in button's Clientside click event i.e 'OnClientClick' event Because to avoid unnecessary postback. Thanks Hari -- modified at 5:00 Friday 2nd November, 2007
Try this javacsript.... function A() { var oas = new ActiveXObject("Scripting.FileSystemObject"); var d = document.a.b.value; var e = oas.getFile(d); var f = e.size; alert(f + " bytes"); }
Arif patel Bangalore
-
Try this javacsript.... function A() { var oas = new ActiveXObject("Scripting.FileSystemObject"); var d = document.a.b.value; var e = oas.getFile(d); var f = e.size; alert(f + " bytes"); }
Arif patel Bangalore
Hi patel I run the above code. I'm getting javascript error at 'var oas = new ActiveXObject("Scripting.FileSystemObject");' saying that 'Microsoft JScript runtime error: Automation server can't create object' What I have to do? Thanks Hari -- modified at 2:42 Monday 5th November, 2007