Friday, July 31, 2009

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

hi,


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 dont 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.

snapdragon2

No comments:

Post a Comment