This control will present the user with an upload file dialog box

http://www.developerfusion.co.uk/show/3905/2/

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.

你可能感兴趣的:(upload)