Upload files from client machine to server
-
Hi All, I have a dll that will be installed and called from clients' machines. This should upload files form these machines to a server. I don't want to upload files directly to the server location. I want to create an ASPX and put it on the server. Then the dll should contact this page and pass to it file stream. And the ASPX should recieve and save the files on the server. I don't know how to access the aspx page and make it do actions (save files) from the dll. Any ideas? Thanks.
-
Hi All, I have a dll that will be installed and called from clients' machines. This should upload files form these machines to a server. I don't want to upload files directly to the server location. I want to create an ASPX and put it on the server. Then the dll should contact this page and pass to it file stream. And the ASPX should recieve and save the files on the server. I don't know how to access the aspx page and make it do actions (save files) from the dll. Any ideas? Thanks.
Hhmm, I´m not sure if I got you right. The dll is on the client an uploads the file to the aspx? So you can just post the file to the aspx:
private void Page_Load(object sender, System.EventArgs e) { foreach(string file in Request.Files.AllKeys) { HttpPostedFile theFile = Request.Files[file]; file.SaveAs(Server.MapPath("DestinationFolder") + "\\" + file.FileName); } }
This should do the file-saving for you. Why do you use a dll to upload a file? Did you had a look on MTOM[^]?(Awesome article!)ASP.NET SEO Blog