Avatar of CyrexCore2k
CyrexCore2kFlag for United States of America

asked on 

Upload Form Question

I am literally beating my head against a wall trying to figure out what is going on with my upload form. Here's the html source for the uploading form.

<html>
<head>
<title>Upload Wizard</title>
<script language="javascript" type="text/javascript">
</script>
</head>
<body>
    <form method="post" enctype="multipart/form-data" action="savefile.asp">
<table>
    <tr>
        <td class="cellTitle">Full Size: </td>
        <td><input type="file" id="filename1" name="filename1" /></td>
    </tr><tr>
        <td class="cellTitle">Small Size: </td>
        <td><input type="file" id="filename2" name="filename2" /></td>
    </tr><tr>
        <td class="cellTitle">Thumbnail Size: </td>
        <td><input type="file" id="filename3" name="filename3" /></td>
    </tr><tr>
        <td>&nbsp;</td>
        <td><input type="submit" value="Upload File" /></td>
    </tr>
</table>
    </form>
</body></html>


Which is simple enough. For testing I've just been trying to upload one file. Something REALLY weird is happening. One file uploads just fine while the other file fails and FF says "Connection to the server was reset" and IE says "This page cannot be displayed." I have looked at the packets going back and forth and here's what's happening with the file that works. (<Client> <Server> and <Binary Data> are tags I have added in for informational purposes.)

<Client>
POST /secureaquotecombackoffice/savefile.asp HTTP/1.1
Host: 75.49.137.241
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://75.49.137.241/secureaquotecombackoffice/uploadform.asp
Cookie: Aff%5FSiteCookie=Aff%5FSubAffiliateID=&Aff%5FAffiliateID=; ASPSESSIONIDQSCDDSDR=JBLDCONCAOBKDBHFNFGAPJEJ
Content-Type: multipart/form-data; boundary=---------------------------3236872634985
Content-Length: 48112

-----------------------------3236872634985

Content-Disposition: form-data; name="filename1"; filename="Advert1Small.jpg"
Content-Type: image/jpeg

<Binary Data>
</Client>

<Server>
100 Continue
Server: Microsoft-IIS/5.0
Date: Mon, 26 Feb 2007 19:13:28 GMT
X-Powered-By: ASP.NET
</Server>

<Client>
<Binary Data>
-----------------------------3236872634985

Content-Disposition: form-data; name="filename2"; filename=""
Content-Type: application/octet-stream


-----------------------------3236872634985

Content-Disposition: form-data; name="filename3"; filename=""
Content-Type: application/octet-stream


-----------------------------3236872634985--
</Client>

<Server>
HTTP/1.1 204 No Content
Server: Microsoft-IIS/5.0
Date: Mon, 26 Feb 2007 19:13:28 GMT
X-Powered-By: ASP.NET
Content-Length: 59
Content-Type: text/html
Cache-control: private

<html><body><h1> HTTP/1.1 204 No Content</h1></body></html>
</Server>

Now with the file that fails.

<Client>
POST /secureaquotecombackoffice/savefile.asp HTTP/1.1
Host: 75.49.137.241
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://75.49.137.241/secureaquotecombackoffice/uploadform.asp
Cookie: Aff%5FSiteCookie=Aff%5FSubAffiliateID=&Aff%5FAffiliateID=; ASPSESSIONIDQSCDDSDR=JBLDCONCAOBKDBHFNFGAPJEJ
Content-Type: multipart/form-data; boundary=---------------------------25385769621668
Content-Length: 119256


-----------------------------25385769621668
Content-Disposition: form-data; name="filename1"; filename="Advert1Main.jpg"
Content-Type: image/jpeg

<Binary Data>
</Client>

<Server>
HTTP/1.1 100 Continue
Server: Microsoft-IIS/5.0
Date: Mon, 26 Feb 2007 19:13:30 GMT
X-Powered-By: ASP.NET
</Server>

<Client>
<Binary Data>
</Client>

<Server>
HTTP/1.1 204 No Content
Server: Microsoft-IIS/5.0
Date: Mon, 26 Feb 2007 19:13:30 GMT
X-Powered-By: ASP.NET
Content-Length: 59
Content-Type: text/html
Cache-control: private

<html><body><h1> HTTP/1.1 204 No Content</h1></body></html>
HTTP/1.1 400 Bad Request
Server: Microsoft-IIS/5.0
Date: Mon, 26 Feb 2007 19:13:30 GMT
Content-Type: text/html
Content-Length: 98

<html><head><title>Bad Request</title></head><body><h1>HTTP/1.1 400 Bad Request</h1></body></html>
</Server>

Can anyone tell me what could cause this? I wasn't aware that a files contents could make or break a web browser request.
ASPWeb Languages and StandardsPHP

Avatar of undefined
Last Comment
B_Dorsey
Avatar of stejam
stejam

Looks to be a size issue for mine, might be timing out before the larger picture is uploaded
Avatar of CyrexCore2k
CyrexCore2k
Flag of United States of America image

ASKER

Well the file is only 113 KB and the web browser shows me an error occured within a second so I don't think that's the issue here.

I'm beginning to think this is a design error of IIS 5.0
Avatar of B_Dorsey
B_Dorsey

using a component to upload or something like freeASPUpload?
Avatar of CyrexCore2k
CyrexCore2k
Flag of United States of America image

ASKER

I haven't even gotten to that part. The upload ASP file only contains HTML code at the moment and the action file is completely blank. If I try to upload one file it shows a blank page (correctly) and if i try to upload the other file it gives me a 400 error.
Avatar of B_Dorsey
B_Dorsey

you are probably caching out the browser, if you dont have anything to catch the file being uploaded then you probably will run into an error... we had this question just a couple of weeks ago...

Include your component and you probably will eliminate the problem,
Avatar of CyrexCore2k
CyrexCore2k
Flag of United States of America image

ASKER

The packets show the browser sending the file information and the webserver sending the 400 reply. This is obviously a server issue.
Avatar of B_Dorsey
B_Dorsey

AGAIN, you are not catching the packets with a component so that it saves the files somewhere... SO again I will write my response.

you are probably caching out the browser, if you dont have anything to catch the file being uploaded then you probably will run into an error... we had this question just a couple of weeks ago...

Include your component and you probably will eliminate the problem.
Avatar of CyrexCore2k
CyrexCore2k
Flag of United States of America image

ASKER

Dorsey you're completely, 100% wrong. I don't know how else to explain this to you.

Look at the packet transcript. The browser sends the data just fine, the binary data that is going across the wire matches the file data EXACTLY. The HTTP is not malformed in any way. /The browser is not the problem./

There is no back end component catching the data. But that has literally /nothing/ to do with the browser.
Avatar of Dave_Dietz
Dave_Dietz
Flag of United States of America image

The problem is that you don't have anything handling the post on the server side.

For the first post the file size is less than the UploadReadAheadBuffer size so IIS catches the data in a buffer before hading it to the ISAPI (asp.dll) to handle.  After the buffer is full the ISAPI takes the rest of the data directly from the client.

In the second post the data after the buffer is full is sent straight to the ISAPI handler and it throws the error since there is nothing to handle the POSTed data.

This is explained in the following KB article:
     You receive more than one "400 bad request" response to one HTTP request in IIS
     http://support.microsoft.com/kb/810957/en-us

"If data that is longer than 49,155 bytes is posted to Microsoft Internet Information Services (IIS) 5.0 or IIS 5.1, and the receiving application does not completely read the data, IIS returns the following HTTP error message to the client:
400 - Bad Request"

Let me know if you have any further questions....  ;-)

Dave Dietz
Avatar of kevp75
kevp75
Flag of United States of America image

Dave, B_D, and stejam are all correct.  The issue is the fact that you are sending binary data over an HTTP connection, that exceeds whatever the boundary limit is.  You can do this without issue up to a certain filesize without producing an error.  (I am unsure what the value actually is, but I am sure that it is listed somewhere on M$ website, maybe even in the MSDN section...).  Once you hit that cutoff, it will error out.

You could send across 30, 1KB files, and it will not error out if the boundary is over 30K, however, if this boundary is 29K, your page will error out, becuase the size of the post exceeds said boundary limit (again, this is just an example, as I am not sure what the actual size is...).  Keep in mind however, this will ONLY happen if you do not have something server side to process the binary data.

Someone please correct me if I am wrong, but I am under the belief that ASP Upload components break the binary data up into manageable packets, stores these packets in server cache, before saving the re-compiled packets to the file system.  In fact, I don't use a component to process file uploads, I use something that Lew Motensen (spelling...) over on Planet Source Code came up with, that uses this same exact method.
ASKER CERTIFIED SOLUTION
Avatar of kevp75
kevp75
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of CyrexCore2k
CyrexCore2k
Flag of United States of America image

ASKER

problem solved months ago.

thanks for your help kevp.
Avatar of B_Dorsey
B_Dorsey

that makes sense <confused>
Avatar of B_Dorsey
B_Dorsey

I dont get it, if it was SOLVED months ago, why would you post on the 14 of this month saying its a server issue?

The answer was given to you MONTHS ago and you kept telling us we were wrong, yo uwould think this is the first time the question was asked....

I dont want the points cause I care less, but this is blatant ignorance, and treats people trying to help him with no respect.

PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo