I am trying out the process of uploading a file from a browser to the IIS 5 server. I have installed the MS Posting Acceptor (cpshost.dll) and the file exists in the C:/InetPub/Scripts folder. I restarted IIS after the installation.


The Code for Posting the file is

<FORM EncType="multipart/form-data" ACTION="http://localhost/Scripts/cpshost.dll?PUBLISH? http://localhost/Exprmnt/FileRecv.asp" METHOD="Post">
<TABLE WIDTH="60%" BORDER=2 ROWS=2 COLS=2>
<TR>	<TD><B>Select The File To Upload</B></TD>
	<TD><INPUT TYPE="File" NAME="File1" id="File1"></TR>
<TR><TD COLSPAN=2 Align="Middle"><INPUT TYPE="Submit" NAME="Upload" VALUE="Upload"></TD></TR>
</TABLE>
</FORM>

After clicking the upload button, I am getting a Blank page with the title "Upload Status" and the address bar shows
ht tp://localhost/Scripts/cpshost.dll?PUBLISH?http://localhost/Exprmnt/FileRecv.asp
But the code in the FileRecv.asp page is not getting executed.

What am I doing wrong ?

{Note: I made changes to the url addresses in this post because the display was incorrect. It is actually http and NOT ht tp in the address bar }

try removing the PUBLISH? command from the line. As far as I know, that should not be in there. Also, why are you using a DLL for this simple thing? All you would have to do is upload the file and save it to a directory.

I looked up the relevant part in MSDN and the code there specifies PUBLISH. It's like ...cpshost.dll?PUBLISH?<<Page That should come after file Upload is complete>>

I know all I have to do is upload the file and save it to a directory. Also the file information should be available to a page that will process the file. So how do I do it ?

http://www.freevbcode.com/ShowCode.asp?ID=4596

This will give you the code so you don't have to do anything besides some basic editing. The backend file you do not have to touch at all. The front end file (name: ...Test) you need to set file names or whatever. Completely done for you and free. All you have to do is call the new properties and submit (which are already done for you on the name:...test page). Otherwise, what you have to do is request all files from the page (or just request one with the name), then save it. This goes way out far and beyond of what is needed, but hey.. extra isn't bad right?

Thanks for your suggestions.

I tried out my solution (that was not working) again as I couldn't find any reason why it shouldn't. Then I realized I have to create a Virtual directory in IIS and set write permission for it. The Uploaded files should be saved in that folder. Create the directory, set the 'save file into folder' part, ran the code again ... and it worked perfectly.

The MS solution you pointed to provides a way for writing a dll (in VB) for uploading. As the Posting Acceptor does the same job, I didn't want to write that part again.

Haven't checked out the freevbcode sample, will do later. Since it provides an ASP class for uploading, it probably would involve either creating a dll or including the class file.

Thanks again for your help

Yeah you would have to include the class file, that's all. It was all written, you just provide the path and the names of the files and it auto saves it accordingly.

I thought you already had the folder and write permissions set to it, so I didn't suggest that. Sorry, could have saved you time and trouble.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.