I have been coding with ASP.NET for a while and like it for the diverse variations in the code, that allow you code whatever you desire. As of late I've been coding an ASP.NET simple [it's basic but highly dynamic] upload function.
This time you will se how easy it is to upload a file to your server, this is a must have function on every website with has an administrator back-end, cms system etc.
The smart thing about fileupload is that you dont have to connect to a server or anything, cause this will be done as you are already on the server when you are on the website, if you know what I mean.
One more thing, you will need the file upload control, it can be added like this.
So lets construct this function.
Code:
<asp:FileUpload ID="FileUpload1" runat="server" />
This alerts the server of the operation in which you are wishing to run. It's simple but does the job required easily.
The next step is to include the file upload code:
Code:
If FileUpload1.HasFile Then
FileUpload1.SaveAs(Server.MapPath("The_Name_Of_The _File"))
End If As you can see its so simple, you just use saveAs then call the server.mappath which calls the current folder on the webserver and lets you give the file a new name to save it.
That is what I call easy coding.