tailieunhanh - Professional ASP.NET 1.0 Special Edition- P8
Professional Special Edition- P8:Those of us who are Microsoft developers can't help but notice that .NET has received a fair amount of visibility over the last year or so. This is quite surprising considering that for most of this period, .NET has been in its early infancy and beta versions. I can't remember any unreleased product that has caused this much interest among developers. And that's really an important point, because ignoring all the hype and press, .NET really is a product for developers, providing a great foundation for building all types of applications | button in that when the button is clicked the form containing the element is submitted to the server along with the coordinates of the mouse pointer within the image. Our demonstration page allows you to set all the commonly used properties for this type of control including the alignment border width alternative text and image source from a selection we have provided as well as the value The HTML we use to create the server control in the sourcecode for the page is input type image id MyControl src runat server The HtmlInputFile Control If you need to allow users to upload files to your server you can use the input type file element. This is implemented as a server control by HtmlInputFile. It has a special property just for this purpose named Accept the MIME type of the file to upload . The other properties are the same as for a textbox element. In our demonstration page you can see the settings we have made. While the Browse button that the control creates allows you to select a file you can t actually upload files with our demonstration application The HTML we use to create the server control in the sourcecode for the page is input type file id MyControl runat server The Code To Upload a File To create a working file upload page all we need is a form with the correct value for the enctype attribute an HtmllnputFile element and a button to start the process form enctype multipart form-data runat server Select File input type file id MyFileInput accept image runat server input type button id SubmitButton value Upload runat server onserverclick UploadFile form div id outError runat server script language VB runat server Sub UploadFile objSource As Object objArgs As EventArgs If Not Is Nothing Then Try c temp Catch objError As Exception Error saving file End Try End If End Sub script The script section following the form contains the code routine
đang nạp các trang xem trước