The OpenD Programming Language

Cgi.UploadedFile

This represents a file the user uploaded via a POST request.

Members

Functions

fileSize
ulong fileSize()
writeToFile
void writeToFile(string filenameToSaveTo)

Static functions

fromData
UploadedFile fromData(immutable(void)[] data, string name)

If you want to create one of these structs for yourself from some data, use this function.

Variables

content
immutable(ubyte)[] content;

The actual content of the file, if contentInMemory == true

contentFilename
string contentFilename;

the file where we dumped the content, if contentInMemory == false. Note that if you want to keep it, you MUST move the file, since otherwise it is considered garbage when cgi is disposed.

contentInMemory
bool contentInMemory;

For small files, cgi.d will buffer the uploaded file in memory, and make it directly accessible to you through the content member. I find this very convenient and somewhat efficient, since it can avoid hitting the disk entirely. (I often want to inspect and modify the file anyway!)

contentType
string contentType;

The MIME type the user's browser reported. (Not reliable.)

filename
string filename;

The filename the user set.

name
string name;

The name of the form element.

Meta