The most basic method of upload is using a plain HTML
form
with the method "post". Its inner HTML should contain a button of the "submit" type. To post a file, you will need an
input
element of the type "file". Minimally, it can be something like this:
<form name="someFormName" enctype="multipart/form-data" action="/some-URL/" method="post">
<!--
<input type="file" name="File"></input>
<!--
<button type="submit">Some button content, like "Post it!" :-)</button>
</form>
All input elements containing data edited by the user and posted to the server side, should be marked with the attributes
name
with unique values; those values are used on the server side to identify, index and retrieve the post data.
More fine-grain method of posting a file could be based on JavaScript using AJAX.
Please see:
http://en.wikipedia.org/wiki/Ajax_%28programming%29[
^],
https://developer.mozilla.org/en/AJAX/Getting_Started[
^].
First method is based on pure HTML, the second one one HTML + JavaScript. Both methods are "raw", do not use any special control, nothing specific to ASP.NET or any other framework. By the way, for proper understanding of technology, it's very important to understand how to work with such basic techniques, not using any frameworks or libraries.
One interesting and advanced approach is using jQuery "uplodify" plug-in:
http://www.uploadify.com/[
^].
See also:
http://ajaxuploader.com/?gclid=CJyZ18qmubECFQff4Aodq3QAlQ[
^].
Processing the HTTP request with ASP.NET (with uploads or not) is a separate story. You can star here:
http://msdn.microsoft.com/en-us/magazine/cc188942.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.web.httprequest.aspx[
^].
This is a minimal code sample:
http://stackoverflow.com/questions/569565/uploading-files-in-asp-net-without-using-the-fileupload-server-control[
^].
By the way, this code sample was in the post in reply to the question almost identical to yours, please see? Why could not you find it by yourself? You are more interested in that than I am. Well, if you have been banned by Google or Bing, this would be a good excuse… :-)
—SA