Click here to Skip to main content
15,900,511 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am selecting the image from the file dialog box. At that time i have to capture the size of selected image . If the size of image is smaller than 5 MB, it will properly insert and if it is greater, then some msgbox will appear. can you please provide the solution?
Posted
Comments
Prasad Khandekar 15-Apr-13 7:00am    
The file dialog box will only return the full path and name of the image file. The size of the image can then be found as shown below.

Function ShowFilerSize(filespec)
Dim fso, f, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(filespec)
s = UCase(f.Name) & " uses " & f.size & " bytes."
ShowFileSize = s
End Function

Regards,
ZurdoDev 15-Apr-13 7:44am    
You should post this as a solution.
Maciej Los 15-Apr-13 8:45am    
Agree ;)
Divs from Bangalore 17-Apr-13 0:52am    
Thanks for the help :)
Maciej Los 19-Apr-13 16:21pm    
Is your issue solved?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900