Monday, August 16, 2010

File upload using asp.net and c#.net?

I have to write code for uploading and downloading files for my website. I was successful in doing this. I am using GridView control to show the files which are in my webserver. The way now I am showing the files is





filename ----- select link


eg: abc.doc ----- select





so when user clicks this select link he will be able to download the file.


But what I want is , if the user directly clicks the file name he should be able to download the file. I am not sure how to do this using GridView control. I don’t want the select link beside the filename.





eg: abc.txt





Any help will be appreciated.File upload using asp.net and c#.net?
The ASP .NET FileUpload control will take care of things. To download, you can use the webclient class in .NET. Some programmers roll their own download, because it is a matter of setting the http header and then sending a stream of bytes (binary for jpegs, for instance).





A nice example of full fledges download/upload controls and folder management in asp .net appeared in asp .net pro - May 2007 ';Build a web based briefcase';. Take a look.

No comments:

Post a Comment