Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Drawing / March 2006

Tip: Looking for answers? Try searching our database.

Image size

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tj2007_1 - 18 Mar 2006 23:31 GMT
I am creating aspx file to upload file.

I allow to user to upload file If that file size is less then 200KB and
after that I want to srink that file up to 50KB (1/4 of original file). And
then store in to database.

Thanks
Tj
Nathan Sokalski - 28 Mar 2006 03:43 GMT
If your question is "How do I determine the size of the uploaded file?" then
you can use the following code:

Use the following in your .aspx file (don't forget to declare it as a
System.Web.UI.HtmlControls.HtmlInputFile in your codebehind file as well):

<INPUT id="fileUpload" type="file" size="100" runat="server">

Use the following properties in your codebehind to determine the file size
in bytes (my code is in VB.NET, but it should be similar in C#):

fileUpload.PostedFile.ContentLength

This is very simple code, just remember that the size is returned in bytes,
so it is possible that you may need to do some simple conversions. If you
have any problems let me know. Good Luck!
Signature

Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

>I am creating aspx file to upload file.
>
[quoted text clipped - 5 lines]
> Thanks
> Tj

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.