Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 99,585 times

Contents

Related Categories

Uploading Images to a Database - Building our Webform

dave123aspx

Building our Webform

Now that we have a warm, fuzzy place to store our images, lets build a webform to upload our images into the database.

Enter A Friendly Name <input type=text id=txtImgName runat="server" >
<asp:RequiredFieldValidator id=RequiredFieldValidator1 runat="server" ErrorMessage="Required" ControlToValidate="txtImgName"></asp:RequiredFieldValidator>
<br>Select File To Upload:
<input id="UploadFile" type=file runat=server>
<asp:button id=UploadBtn Text="Upload Me!" OnClick="UploadBtn_Click" runat="server"></asp:button>
</form>

The first interesting point about our webform, is the attribute "enctype". Enctype tells the browser and server that we will be uploading some type of binary data. This binary data needs to be parsed, using a different mechanism from our normal text data. The next control we of interest is the type=file control. This control will present the user with an upload file dialog box. The user browses for the file they want to upload.

Comments

  • Re: [3905] Uploading Images to a Database

    Posted by KingNetSurfer on 15 Jun 2006

    This may sound weird but I think I'm the only one not having perfect success with this.

    I'm getting a System.NullReferenceExc...

  • Image upload and thumbnails

    Posted by zioturo on 02 Nov 2005

    The easiest way to upload and resize an image to the internet and automatically create thumbnails is I-Load.
    I-Load is a FREE ASP.NET web control with numerous benefits and features.
    You can downloa...

  • Uploading

    Posted by harshguglani on 03 Sep 2005

    Hi, Whts the benifit of uploading images in database server when i can place images on web server in my directory and accesss them. Reply soon.

  • enctype?

    Posted by LesBillBell on 02 Aug 2005

    The explanatory text says "The first interesting point about our webform, is the attribute "enctype". Enctype tells the browser and server that we will be uploading some type of binary data" but I don...

  • Posted by LinuxGold on 08 Jul 2005

    Better control of file updates. On file server, anybody can update files without letting anyone know about it. If you store a file inside SQL database, it will show who last updated files, inform us...