Image File Upload to Remote Server Issue RRS feed

  • Question

  • User-1061167628 posted
    Ok, not sure if this is the best place for this post, but here it goes... I have a standard web form, w/ all the proper encoding in the form tag for uploading files. On this page I have a standard HtmlInputFile object. In my code behind I call a class that I created which is nothing more than a quick way for me to call a number of items related to the file selected for uploading. i.e. the class returns the file size, type, etc. It uses the standard objInputFile.PostedFile.SaveAs(pathToSave & strFileName) where objInputFile = HtmlInputFile and pathToSave is a parameter sent when calling the class. I've tried many methods here but typically use MapPath("../images")to return the proper path of the directory on the server. So, this works great on my development box. In this case IIS is running locally as is the browser. The issue becomes apparent when I have placed my code onto a remote web server. The server is internal to our network and there is no proxy server being used to connect. I receive no error message when I click the button to upload the file, nor does the file actually upload. Any ideas or suggestions? -Kirk
    Wednesday, September 8, 2004 11:11 AM

All replies

  • User69449789 posted
    The best way I've found to do this (the best meaning the least number of headaches) is to put the absolute path to the directory within the web.config and forget about using MapPath or any other "magic bullet directory finder" methodology. At least with the web.config entry you know exactly where your problem lies if you are having trouble finding a directory. It's a lot less fun to be forced to recompile, redeploy, trace, etc. etc. ad nauseum until you stumble upon the answer.
    Thursday, October 14, 2004 11:18 AM
  • User-1061167628 posted
    Thanks for the suggestion. As it turns out I recently (2 days) ago must of gotten over my brain seisure. I simply shared the directory on the server and provided the UNC path of the share. This worked perfectly. Now for the future I may change the impersonation during the save process so that I don't have to make a share that the app users can get to, but in this case it was better to share it for later modification. For those who don't like paragraphs.... Use the UNC path when saving files through a remote IIS server!
    Thursday, October 14, 2004 1:16 PM