Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. File Upload to another server [modified]

File Upload to another server [modified]

Scheduled Pinned Locked Moved ASP.NET
helpsysadmindatabasecomhosting
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GaryWoodfine
    wrote on last edited by
    #1

    Hi guys I got a bit of a problem that has taken me days to try and sort out and I'm getting nowhere. basically I have to servers that are setup in a DMZ, as a workgroup, one server is a Application Server and the other is a Database and File Server. I need to be able to be able to upload files from the application server the file server via a UNC path. but everything I have tried seems to fail. I recieve errors along the lines of "can't find part of path", "incorrect user/password", etc. I have tried a Myriad of approaches including creating a user account on both machines, and impersonating that account, to write, Created a Virtual Directory and used : string SaveLocation =System.Web.Hosting.HostingEnvironment.MapPath ("~/webmedia/article/" + fn ) To get the UNC path, Stored the UNC path in the Web.config file, but nothing seems to work. I haved scoured the net for any information, but seem to have got nowhere, I have found one or two articles but they basically tell me what I have tried. I was wondering if anybody knows of any other Tut's/atricles I could read. I have included some of my code in the help somebody could spot an error HttpPostedFile selectedPDF = ImageUploadFile.PostedFile; if ((selectedPDF != null) && (selectedPDF.ContentLength > 0) && selectedPDF.ContentType == "application/pdf") { try { string fn = System.IO.Path.GetFileName(selectedPDF.FileName); string dir = ConfigurationManager.AppSettings["docpath"].ToString(); // string SaveLocation =System.Web.Hosting.HostingEnvironment.MapPath ("~/webmedia/article/" + fn ); string SaveLocation = ConfigurationManager.AppSettings["devdocpath"].ToString() + fn; selectedPDF.SaveAs(SaveLocation); ..... -- modified at 8:47 Wednesday 7th November, 2007 I have tried doing a simple app here locally on my own network and haven't even tried using impersonation, but it just works here is the sample code. I am completely baffled try { HttpPostedFile theFile = FileUpload1.PostedFile; //System.IO.Path.GetFileName(selectedPDF.FileName) FileUpload1.SaveAs(@"\\Cyko\d\" + System.IO.Path.GetFileName(theFile.FileName).ToString()); }

    Kind Regards, Gary


    My Website ||

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups