Uploading file to another drive

Discussion in 'ASP .Net' started by Mark Brown, May 24, 2010.

  1. Mark Brown

    Mark Brown Guest

    I'm trying to create a web page that allows the user to upload a file. If I set the save path somewhere on drive C:\, it works just fine. However, I need it to save elsewhere, like drive E:\. When I do this, I get an error saying "Could not find a part of the path '...' and then is lists the path. All the pieces of the path are there and if you change E: to C:, it works.

    Is there some concept I'm missing or is it just not possible for a web page to save someplace other than C:\?

    Here's the code that does the saving:

    Dim fn As String = System.IO.Path.GetFileName(File2.PostedFile.FileName)
    Dim SaveLocation As String = "e:\webtst\images\" & Session("CADNum") & "\" & fn

    Try

    Directory.CreateDirectory("e:\webtst\images\" & Session("CADNum"))
    File2.PostedFile.SaveAs(SaveLocation)
    SaveLocInfo(SaveLocation)

    Catch ex As Exception
    Dim Tmp As String = ex.Message
    End Try

    The session variable does contain a value.

    Thanks,
    Mark
    Mark Brown, May 24, 2010
    #1
    1. Advertising

  2. "Mark Brown" <> wrote in message
    news:uVH8zI1%...

    > Is there some concept I'm missing or is it just not possible for a web
    > page to save someplace other than C:\?


    Does the webserver actually have an E:\ drive mapped...?


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
    Mark Rae [MVP], May 24, 2010
    #2
    1. Advertising

  3. Mark Brown

    Mark Brown Guest

    On the server it will run on, the E: drive is a local harddrive. On my
    development system, the E: drive was created by a SUBST command.

    "Mark Rae [MVP]" <> wrote in message
    news:...
    > "Mark Brown" <> wrote in message
    > news:uVH8zI1%...
    >
    >> Is there some concept I'm missing or is it just not possible for a web
    >> page to save someplace other than C:\?

    >
    > Does the webserver actually have an E:\ drive mapped...?
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
    Mark Brown, May 24, 2010
    #3
  4. Mark Brown

    Mark Brown Guest

    For grins I loaded the program on the server it will be running on...and it
    worked like a champ. I guess it doesn't like drives created by SUBST.


    "Mark Rae [MVP]" <> wrote in message
    news:...
    > "Mark Brown" <> wrote in message
    > news:uVH8zI1%...
    >
    >> Is there some concept I'm missing or is it just not possible for a web
    >> page to save someplace other than C:\?

    >
    > Does the webserver actually have an E:\ drive mapped...?
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
    Mark Brown, May 24, 2010
    #4
  5. On May 24, 9:46 pm, "Mark Brown" <> wrote:
    > For grins I loaded the program on the server it will be running on...and it
    > worked like a champ.  I guess it doesn't like drives created by SUBST.
    >
    > "Mark Rae [MVP]" <> wrote in messagenews:...
    >
    >
    >
    > > "Mark Brown" <> wrote in message
    > >news:uVH8zI1%...

    >
    > >> Is there some concept I'm missing or is it just not possible for a web
    > >> page to save someplace other than C:\?

    >
    > > Does the webserver actually have an E:\ drive mapped...?

    >
    > > --
    > > Mark Rae
    > > ASP.NET MVP
    > >http://www.markrae.net


    I think that the problem there is that the drive created by subst is
    available only within the process of the user that created it. That's
    why you can't access E:\ at IIS.

    Instead of subst try to use Junction by Mark Russinovich
    http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx
    Alexey Smirnov, May 26, 2010
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon
    Replies:
    5
    Views:
    11,129
    Scott M.
    Jan 17, 2010
  2. mh
    Replies:
    4
    Views:
    687
    Wolfgang Strobl
    May 31, 2005
  3. Tom Anderson
    Replies:
    8
    Views:
    385
    Gerrit Holl
    Sep 15, 2005
  4. Mike Joyce
    Replies:
    3
    Views:
    3,121
    Gordon Rainsford
    May 3, 2006
  5. shailesh
    Replies:
    1
    Views:
    766
    Tim Golden
    Mar 28, 2007
Loading...

Share This Page