Click to See Complete Forum and Search --> : Upload files from client to IIS


tintins
February 19th, 2001, 08:55 AM
Hi,

I had tried uploading files from client to IIS using CPShost.dll(a posting acceptor which is found as a part of the Site Server Express -> according to MSDN). Below are samples of my script

1)postlogon.asp

<%
strLogonUser = Request.ServerVariables("LOGON_USER")
%>

<html>
<body>
<h2 align="center">Upload File</h2>
<hr>
<form enctype="multipart/form-data" action="/scripts/cpshost.dll?PUBLISH?http://<%= Request.ServerVariables("SERVER_NAME") %>/program/asp/up2/repost.asp" method="POST">
<center><table border="1">
<tr>
<th align="center" colspan="2">Select the document that you want to upload to server</th>
</tr>
<tr>
<th align="left">File to upload</th>
<td align="left"><input name="file" type="file" size="30"></td>
</tr>
<tr>
<th align="left">Destination URL</th>
<td align="left"><input type="text" name="TargetURL" value="/program/doc/<%=strLogonUser%>/" size="30">
<input type="Submit" value="Upload..."></td>
</tr>
</table></center>
</form>
</body>
</html>

2)repost.asp

<% Response.Buffer = TRUE %>
<HTML>
<HEAD>
<TITLE>
Upload Result
</TITLE>
<SCRIPT LANGUAGE="vbscript">
Sub cmdSubmit_OnClick
window.navigate "http://servername/program/asp/mainctrl.asp"
End Sub
</SCRIPT>
</HEAD>
<BODY>
<H1><CENTER>
Here is your upload status:<BR>
</CENTER></H1>
<HR>

Destination: <B><% Response.Write Request.Form("TargetURL") %></B><BR>
<HR><BR>

<%
For I = 1 To Request.Form("FileName").Count
Response.Write "Uploaded File: <B>" & Request.Form("FileName")(I) & Request.Form("FileExtention")(I) &"</B><BR>"
Response.Write "Physical Path: <B>" & Request.Form("FilePath")(I) & "</B><BR>"
Response.Write "Size: <B>" & Request.Form("FileSize")(I) & "</B><P>"
Next

%>

<FORM>
<INPUT TYPE="BUTTON" NAME="cmdSubmit" VALUE="Return">
</FORM>
</BODY>
</HTML>


Postlogon.asp is a form that allows me to select a file from local machine to upload to a destination on the IIS. Upon clicking the 'upload button', it should navigate to repost.asp with CPShost.dll (this dll is suppose to upload the file for me -> according to MSDN). This dll was placed in /Inetpub/scripts/, as recommended in MSDN. However, when I clicked the submit button, it didn't navigate to repost.aps. Instead, an error 'http500-Internal server error' was displayed.

I guessed that it could be my configuration in my server. But I'm clueless on where exactly had things gone wrong. I would really appreciate if someone could really guide me. thanks!

A million thanks from,
Tin tin