Tuesday, July 28, 2009

How to upload file in ASP.Net C# without using the FileUpload web control?

I'm trying to upload files using ASP.Net (C# based) but using only programming. I mean i don't want to use the FileUpload web control, i know it much easier but I want to know how to make the browse dialog, and when selecting a file i put it in a textbox, then i know the rest where you read the file as a stream and then save it locally on your computer or in the server, I know that in windows application just use the OpenFileDialog and that's it, but in ASP.Net it's different, and when I've added the System.Windows.Forms reference, it didn't work correctly.


Please I need your help

How to upload file in ASP.Net C# without using the FileUpload web control?
The only possible way to do something like this would be to upt the file upload control on the page, but hide it with CSS and then use javascript to recreate everything.





The reason you can't use System.Windows.Forms reference is because it expects the presentation layer to be on the same box as the rest of the code. In ASP.NET, you are using HTML for your presentation layer, which will be on another computer and may not even be Windows.


No comments:

Post a Comment