home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2001 March
/
PCWorld_2001-03_cd.bin
/
Software
/
Topware
/
aspedit
/
_SETUP.1
/
upload.aspx
< prev
next >
Wrap
Text File
|
2000-08-24
|
1KB
|
60 lines
<% @Page Language="C#" %>
<html>
<head>
<title>Uploading data in ASP+</title>
</head>
<body bgcolor="#ffffff" style="font:8pt verdana;">
<script language="C#" runat="server">
void btnUploadTheFile_Click(object Source, EventArgs evArgs)
{
string strFileNameOnServer = txtServername.Value;
string strBaseLocation = "c:\\temp\\";
if ("" == strFileNameOnServer)
{
txtOutput.InnerHtml = "Error you must name a datafile";
return;
}
if (null != uplTheFile.PostedFile)
{
try
{
uplTheFile.PostedFile.SaveAs(strBaseLocation+strFileNameOnServer);
txtOutput.InnerHtml = "Data succesfully<b>" +
strBaseLocation+strFileNameOnServer+"</b> uploaded";
}
catch (Exception e)
{
txtOutput.InnerHtml = "Error during upload<b>" +
strBaseLocation+strFileNameOnServer+"</b><br>"+ e.ToString();
}
}
}
</script>
<table>
<form enctype="multipart/form-data" runat="server">
<tr>
<td>name on local drive</td>
<td><input id="uplTheFile" type=file runat="server"></td>
</tr>
<tr>
<td>Name on server:</td>
<td><input id="txtServername" type="text" runat="server"></td>
</tr>
<tr>
<td colspan="2">
<input type=button id="btnUploadTheFile" value="Speichern"
OnServerClick="btnUploadTheFile_Click" runat="server">
</td>
</tr>
</form>
</table>
<span id=txtOutput style="font: 8pt verdana;" runat="server" />
</body>
</html>