Please enable JavaScript to view this site.

A-Shell Reference

Navigation: Subroutines > HTTP

Customizing REQUPLOAD Headers

Scroll Prev Top Next More

Revised January 2022

When using the XHTTPF_REQUPLOAD flag to upload files, the generated request will contain a header for each file, specifying a content-type and name attribute. For example, if request = "myfile.qry", the generated header will look something like:

Content-Disposition: form-data; name="file"; filename="myfile.qry"

Content-Type: application/octet-stream

 

You can modify the default Content-Type and Content-Disposition headers by prepending a control sequence prefix to the front of each filespec in the list specified in the request parameter. The format of the prefix is:

Content-Type=<type>|<name>=

 

where <type> may be any content-type string, known or unknown, and <name> is the value of the "name" attribute to be associated with the file. For example:

request$ = "Content-Type=text/html|homepage=c:\temp\mypage.txt"

 

In the above case, the header generated and sent to the web server would look something like:

Content-Disposition: form-data; name="homepage"; filename="mypage.txt"

Content-Type: text/html 

 

To upload multiple files in a single request, just separate them in the request parameter string with semicolons. Any filename which does not start with the "Content-Type" prefix will be given the default treatment, with the Content-Type being set according to the file extension, and the name attribute set to "file" (,"file2", etc.)