Saturday, March 24, 2012

MapPath Problem

I'm trying to allow users to upload files to our web server. Unfortunately, it hasn't been as easy as I had hoped.

I'm using the HtmlInputFile to get the file. Then I'm using the PostedFile.SaveAs to try and save it. When I worked with it locally, it worked fine (I was saving it in C:\temp\). When I move it to our servers, I am having great difficulty finding a home for the files. Everything I try I get errors.

I can access the files on the server is at \\mgi2kap\$intranet\

The files on the server are at C:\apps\mgintranet\

The following is evertying I have tried (with and without Server.MapPath):


strBaseLocation = @dotnet.itags.org."C:\Apps\Intranet\";

strBaseLocation = @dotnet.itags.org."\\mgi2kap\intranet$\";

strBaseLocation = @dotnet.itags.org."C:\inetpub\wwwroot\mgintranet\"";

strBaseLocation = @dotnet.itags.org."C:\Temp\";

The errors i consistently receive are:
The given path's format is not supported.
or
Virtual path expected.

Hopefully, someone can point me in the right direction. As I have been working with this all day and it has produced quite a headache!!!

Thanks
dlcany thoughts?
Here is a path I use that works:
string line;


StreamReader sr = new StreamReader("C:\\apps\\Intranet\\test.txt");
while ((line = sr.ReadLine()) != null)
{
Response.Write(line);
}

for reading the text in a file.

0 comments:

Post a Comment