Back to product page

Uploads property

Returns collection of uploaded files/variables.


  • Basic
object.Uploads [= value]
The Uploads(object,value) syntax has these parts:
objectAn expression evaluating to an object of type WebRequest
valueA value.


Uploads property returns reference to WebRequestUploads object - responsible for parsing user's Request and access parts of the request if request contained multipart/form-data content type. If client did not sent request of such type, this property will still return valid reference, but Uploads.Count will be 0.

This property is actually very convinient for accessing files uploaded by client. For example, you can do this:
User.Request.Uploads(0).Save "c:\somepath\somewhere"

or, you can check out headers that describe specific part, like this:

which will give you much more information about uploaded content. For your reference, typical form-upload content looks like this:
POST /upload.htm HTTP/1.1
Content-Type: multipart/form-data; boundary=---------------------------7d42bf19d0826
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)
Host: localhost
Content-Length: 122621

Content-Disposition: form-data; name="TheFile"; filename="access.c"
Content-Type: text/plain

#include "access.h"
#include "message.h"
#include "tags.h"
#include "attrs.h"
#include "tmbstr.h" of the file comes here...
Content-Disposition: form-data; name="Name"

this is some data
Content-Disposition: form-data; name="Submit"

in this specific case, there will be 3 parts returned with Uploads property. We colored with blue headers for each part (accessible through Uploads(xyz).Headers ) and each body with red color (accessible through Uploads(xyz).Body or Uploads(xyz).Save )

Just for the reference, you can copy/paste this HTML code to see how does web page look like when data is to be uploaded on the server: <HTML><BODY>
<FORM action="upload.htm" method=post encType="multipart/form-data">
<INPUT type=file size=75 name=TheFile> <BR>
<INPUT size=53 value="Enter your name here...." name=Name>
<INPUT type=submit value=Submit name=Submit></FORM>