Hi Liste,

ich habe das folgende Problem. Ich m�chte, dass eine Datei in ein bestimmtes
Verzeichnis geschrieben wird. Nur leider klappt das mit dem Mappath befehl
nicht so wie ich es will

Verzeichnisstruktur:     <root>/verzeichnis1/verzeichnis2/upload/

Code:

<script language="C#" runat="Server">
//Event Handler for the upload button
void UploadFile(object Sender,EventArgs E)
{
if (File1.PostedFile !=null) //Checking for valid file
{
// Since the PostedFile.FileNameFileName gives the entire path we use
Substring function to rip of the filename alone.
string StrFileName =
File1.PostedFile.FileName.Substring(File1.PostedFile.FileName.LastIndexOf("\
\") + 1) ;
string StrFileType = File1.PostedFile.ContentType ;
int IntFileSize =File1.PostedFile.ContentLength;
//Checking for the length of the file. If length is 0 then file is not
uploaded.
if (IntFileSize <=0)
Response.Write(" <font color='Red' size='2'>Dateiupload " + StrFileName + "
misslungen. </font>");
else
{

______PROBLEM______

File1.PostedFile.SaveAs(Server.MapPath(".\\verzeichnis1\verzeichnis2\upload\
" + StrFileName));
Response.Write( "<font color='green' size='3'>Die Datei " + StrFileName + "
des Types " + StrFileType + " und der Gr��e " + IntFileSize.ToString() + "
Byte, wurde erfolgreich �bertragen.</font>");
}
}
}
</script>


Vielen Dank

C.





| [aspdedotnet] als [email protected] subscribed
| http://www.dotnetgerman.com/archiv/aspdedotnet/ = Listenarchiv
| Sie k�nnen sich unter folgender URL an- und abmelden:
| http://www.dotnetgerman.com/listen/aspDEdotnet.asp

Antwort per Email an