FileUpload control question: uploader.PostedFile.Method/Property vs uploader.Method/Property

I'm trying to use the FileUpload control in but I'm confused about the uploader's methods and its uploader.PostedFile methods / properties.

uploader.SaveAs() vs uploader.PostedFile.SaveAs() ?
uploader.FileName vs uploader.PostedFile.FileName ?
uploader.FileContent vs uploader.PostedFile.ContentType ?
uploader.FileByte vs uploader.PostedFile.ContentLength?

So PostedFile refers to the object that's already been uploaded? Does that mean if I were to restrict the extention/size of an uploaded file, I actually do it after the file's been uploaded ? Is there a way to  not even start the upload process if the filename/file size does not meet my requirements?

6/21/2007 8:14:21 AM 93655 articles. 5 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 30

Sorry to bring this up again. The post was already bottom of page when it was approved. ;/

6/21/2007 11:29:26 AM


FileUpload.PostFile is HttpPostedFile. HttpPostedFile has members of its own  such as ContentLenth, contentType, FileName and InputStream or SaveAs

FileUpload is a class itself, and it has its own members such as FileName, FileContent and etc, they are implemeted using HttpPostedFile. So some times you can use HttpPostedFile instead.

For more information, please read

Hope it helps,


Jessica Cao
Microsoft Online Community Support

“Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
6/25/2007 7:38:19 AM

Similar Artilces:

remove property or method from control which inherited from web control
hello. how i can remove property or method of my custom control whitch inherited from web conrol class You can't really "remove" an inherited member. Although, you can hide them from the propertygrid/intellisense by applying the Browsable(false) and EditorBrowsable(false) attributes. You can also functionally hide them by creating new (VB - Hides or Shadows) private properties with the same name as the base ones. NB: The "removed" props can still be accessed by casting to the base type....

How to access the properties and methods of the ActiveX control on the client side in Web Form using javascript or vbscript
Hi All, I have looked almost every where for this, and I'll be really appreciated if someone can help me with this. I found a article in MS KB article, #317392, but it is not extactly what I wanted. How do you reference an ActiveX control's methods and properties with javascript in the ASPX? Following is what I have. Some how the following line in the btnclick() does not seems to be working. AlarmCtl.StartTimer() I have done this with just .HTML and it works just fine. Can any one help. Thanks in advance. //===========================...

passing 20 variables to a method: property VS method
My site has seperate data access layer and the aspx.cs simply calls the methods from the data access layer.Now I need to add another functionality where in I accept 20 input fields and have to pass these to a method in the access layer for further processing.What is better:1. Create and Call the method with all the 20 variables.2. Have these as properties : set them individually and call the method to execute?Not sure which is better in terms of security and performance. Thanks,  THe software we design is pretty complex. SO in a situation like this I would have both. Ex: Public&n...

AddParsedSubObjects vs Other methods for persisting control properties
I have been using AddParsedSubObjects and regular expressions to persist my properties in webcontrols. I have some simple classes that store font names or font sizes and one class which has a WebControl.Style + WebControl.ListItemCollection + string. I would like any derived classes to be easily extended to support further properties..... For example I have this class: (What is the best way to persist these properties in a web control, am I going about this the wrong way by using AddParsedSubObjects? :::Class example::: #region fontNamesCollection public class fontNameColl...

Methods to upload pics/vids from FileUpload control
Hi, I was wondering if anyone has some good reading on uploading pics/vids to a server location foreach user? the thought of it is to get the username or userid, and rename the pic or vid with the username adn then save it on disk. the only problem with that is when the number of users expands, the search through all those pics/vids for the right file will be time consuming. Just wondering if anyone has implemented this technique, and what methods/architecture did you use? Thanks! --and learning.. I'd think the best way would be to create a reference table. Create a for your...

Place web method in code behind
We use Ajax now and are looking at Atlas.  We got the web service to work in a separate .asmx file.  We got the web method to work when it is in the .aspx file wrapped in <script runat="server"> </script> tags.  However, we would very much like to move the method to the code behind file.  The no longer works.  Nor can we call it using the  So, what to do?  Does Atlas allow for putting the web method in the associated code behind file?  If so, I would like an example.  The examples I've seen claiming to us...

Create 'Selectable Property' in VS Property Pane for Custom Web Control
 I'm creating a custom web control and would like some of the properties to be contained in a DropDownList.  Just like if you use a boolean property, there is a "True/False" DropDownList in the properties.  Does that make sense?  Can someone point me in the right direction?"The pursuit of easy things makes men weak"~David O. McKay  Place something like this on your server control page.  I don't have a CS Example for you. Change the names to your requirements <Bindable(True)> _ <Category("Field")> _ <...

DataGrid Methods Vs Events Vs Properties
Ok, I have the following lines of code from the quickstart tutorial and am wondering what is going on <asp:DataGrid id="mydataGrid" runat=server OnSortCommand="SomeFunction" /> public void SomeFunction(Object sender, DataGridSortCommandEventArgs e) { blah blah.. } I am using web matrix and looking at the datagrid class which states OnSortCommand as a method I usually can't set a method equal to something and have things work out well.. So I'm lost. I can't figure out how these three things are linked. the OnSortCommand Method, So...

accessing user control property and method from code behind in 2.0
I am working in 2.0.  I am creating an user control and want to access the public property from page code behind page but its generating error.My code is------------------------------------------------------------------------------------------ MyUC.ascx  <%@ Control Language="VB" AutoEventWireup="false" CodeFile="MyUC.ascx.vb" Inherits="MyUC" %>Imports System.DataPartial Class MyUC    Inherits System.Web.UI.UserControl  Private _data As DataTable    Public Property MyDataSource() As DataTable&n...

Access a Web User Control Method from a Web Form
I'm trying to pass the Selected Index value from a web user control in a web form to the user controls selectedIndexchanged Sub.  I can't seem to figure out how to pass the information that I need to the user control and have it execute the sub routine. In the SelectedInedxChanged Sub I have a switch Statement and I want to get the index value from the web form where the user control is located and compare it to each case and then to have it execute the code for the case that it matches. What do I need to do? Hi, I am not sure if I understood your question correctly. I su...

An object reference is required for the nonstatic field, method, or property 'System.Web.UI.Control.ViewState.get'
can somebody tell me, how can I use a ViewState variable inside of a static method?  My code here: public static List<cast> GetCastByLetter(string crewType, string letterFilter, string sortExpression){  ...switch (ViewState["_LetterFilter"]) { ... }}and my error :-)An object reference is required for the nonstatic field, method, or property 'System.Web.UI.Control.ViewState.get'Its all about coding! Reference the Current Handler as your Page. Then access the ViewState collection from the Page reference. public static List GetCastByLetter(string crewT...

Access Web Control's property within the Web Form
Hello, I have a Web Control which has a TextBox and a Button. I want to put this Control on a WebForm, then put some text in a Control's TextBox, press on Control's Button and be able to access text box's value from within the Web Form. That's my Control: _________________________________________________ public class Colo : System.Web.UI.UserControl { protected System.Web.UI.WebControls.TextBox TextBox1; protected System.Web.UI.WebControls.Button Button1; public string Myval{ get{return (string)ViewState["myval"];} set{ViewState["myval"] = va...

Properties vs method parameters
When writing a new class, how do I know when to make use of a property as apposed to passing the variable through a method parameter. Here's a stoopid example of updating someone's name in the database. Is this better practice? Public Class Person Private vName As String Public Property Name() Get Return vName End Get Set(ByVal Value) vName = Value End Set End Property Public Sub UpdateName() 'do DB update using vName End Sub End Class Or is this better ...

How to upload an Outlook Message in File Upload control in .Net
Hi All, Is it possible to upload an outlook message from outlook in File Upload control.Please don't suggest to save the message onto the desktop and then upload it!   What I am after is really navigating to the outlook folders through the File Upload control and upload a message.  Thanks guys   If there is a way to do it, but it could be used to maliciously read someone's email folders, forgive me if I hope no one answers you. :)...

Web resources about - FileUpload control question: uploader.PostedFile.Method/Property vs uploader.Method/Property -

Bradstick (@bradstick_lsb) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Ho Chi Minh Thought - Wikipedia, the free encyclopedia
Ho Chi Minh Thought is an ideology that adapts Marxism–Leninism to the specific social, political, and economic conditions of the Vietnamese ...

Plop - Contact
Home What is Plop? Newsletter / RSS Boot Managers (2) Plop Linux Android Apps VHD Loader HFS+ Rescue Xorg Touchscreen pimgrestore Flybook Linux ...

Summer resort recommendation special
Summer resort recommendation special ,China Forum

Implementing an Image Gallery using ASP.NET MVC

Login Login To Subscribe This Plan Remember me Log in Forgot username? Forgot password? Registration Register Bang2Joom Pricing Templates Extensions ...

Content Management » Basex Blog »
Ten years ago, Basex laid the groundwork for the Collaborative Business Environment (CBE), a conceptual framework for a workspace for the knowledge ...

For the website, I've kept the default styles when you create a new ASP.NET Web Application, removing the two content pages that come by default ...

Latest Updates
Latest Updates - Free source code and tutorials for Software developers and Architects.; Updated: 15 Feb 2013

Apache Struts security update fixes critical vulnerabilities
The Apache Software Foundation has released Struts, a security update for its popular Java Web application development framework that ...

Resources last updated: 1/22/2016 8:03:13 PM