Archived Forum Post

Index of archived forum posts

Question:

UploadRcv not seeing files

Oct 09 '14 at 05:30

Hi, I've just setup a new server with the latest chilkatupload.dll. For some reason the server isn't seeing the files or form values being posted. Everything looks fine from a code point of view... any ideas?

alt text


Answer

alt textFound the answer for this. In IIS7, you need to change the ASP / maxRequestEntityAllowed setting to > 200KB if you want to upload files larger than that. Otherwise the uploadrcv object returns a null POST.


Answer

I tested with v9.4.1, and also with Chilkat's latest internal pre-release:

64-bit: http://www.chilkatsoft.com/preRelease/ChilkatUpload_x64-9.4.1-x64.zip
32-bit: http://www.chilkatsoft.com/preRelease/ChilkatUpload-9.4.1-win32.zip

and in both cases, everything worked fine.

To ensure the HTTP request (i.e. the multipart/form-data) is a correct and valid one, send it with a browser via a simple HTML form such as this:

<html>
<body>
<form method="POST" enctype="multipart/form-data" action = "http://www.yourdomain.com/yourScript.asp" >
<input name=hid1 type=hidden value="test123">
<input name=hid2 type=hidden value="abcdef">
<input name=attach1 type=file size=20>
<input type=submit value="Upload">
</form> 
</body>
</html>

My receiving ASP script looks like this:

<% @CodePage = 65001 %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
'  The Chilkat ASP Upload component is freeware.
'  The UploadRcv object receives uploads in ASP.
'  It can be used to save uploaded files to the web server,
'  or to save directly to memory for immediate access.
set receiver = Server.CreateObject("Chilkat.UploadRcv")

'  Stream uploads to a directory:
'receiver.SaveToUploadDir = 1
'  
receiver.UploadDir = Server.MapPath("receivedData")

'  Don't allow anything over 1MB
receiver.SizeLimitKB = 1000

'  Set a timeout just in case something hangs
'  This is a 20-second timeout:
receiver.IdleTimeoutMs = 20000

'  Consume the upload.  Files are streamed to the UploadDir
success = receiver.Consume()
    Response.Write receiver.LastErrorHtml

If (success = 0) Then
    Response.Write receiver.LastErrorHtml
Else
    '  Display the files received:
    Response.Write "<p>Num file received: " & receiver.NumFilesReceived & "</p>"
    If (receiver.NumFilesReceived > 0) Then
        For i = 0 To receiver.NumFilesReceived - 1
            Response.Write "<p>Received " &  receiver.GetFilename(i) &  " (" & receiver.GetFileSize(i) & " bytes)</p>"
        Next
    End If

Response.Write "<p>Success.</p>"
End If

Response.Flush()

%>
</body>
</html>