C# Класс norvanco.http.MultipartForm

Allow the transfer of data files using the W3C's specification for HTTP multipart form data. Microsoft's version has a bug where it does not format the ending boundary correctly. Written by: [email protected]
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
coRequest System.Net.HttpWebRequest

Открытые методы

Метод Описание
MultipartForm ( string url ) : System

Initialize our class for use to send data files.

getFileheader ( string aFilename ) : string

Returns the proper content information for the file we are sending.

Hits Patel reported a bug when used with ActiveFile. Added semicolon after sendfile to resolve that issue. Tested for compatibility with IIS 5.0 and Java.

getFiletrailer ( ) : string

Creates the proper ending boundary for the multipart upload.

getFormfields ( ) : string

Builds the proper format of the multipart data that contains the form fields and their respective values.

getResponse ( ) : void

Here we actually make the request to the web server and retrieve it's response into a text buffer.

getStream ( ) : Stream

Determines if we have a file stream set, and returns either the HttpWebRequest stream of the file.

sendFile ( string aFilename, CookieContainer cookies ) : void

Transmits a file to the web server stated in the URL property. You may call this several times and it will use the values previously set for fields and URL.

sendFile ( string aFilename, Stream readIn, CookieContainer cookies ) : void
sendFile ( string aFilename, byte data, CookieContainer cookies ) : void
setField ( string key, string str ) : void

Allows you to add some additional field data to be sent along with the transfer. This is usually used for things like userid and password to validate the transfer.

setFilename ( string path ) : void

Used to signal we want the output to go to a text file verses being transfered to a URL.

writeString ( System io, string str ) : void

Mainly used to turn the string into a byte buffer and then write it to our IO stream.

Описание методов

MultipartForm() публичный Метод

Initialize our class for use to send data files.
public MultipartForm ( string url ) : System
url string The web address of the recipient of the data transfer.
Результат System

getFileheader() публичный Метод

Returns the proper content information for the file we are sending.
Hits Patel reported a bug when used with ActiveFile. Added semicolon after sendfile to resolve that issue. Tested for compatibility with IIS 5.0 and Java.
public getFileheader ( string aFilename ) : string
aFilename string
Результат string

getFiletrailer() публичный Метод

Creates the proper ending boundary for the multipart upload.
public getFiletrailer ( ) : string
Результат string

getFormfields() публичный Метод

Builds the proper format of the multipart data that contains the form fields and their respective values.
public getFormfields ( ) : string
Результат string

getResponse() публичный Метод

Here we actually make the request to the web server and retrieve it's response into a text buffer.
public getResponse ( ) : void
Результат void

getStream() публичный Метод

Determines if we have a file stream set, and returns either the HttpWebRequest stream of the file.
public getStream ( ) : Stream
Результат System.IO.Stream

sendFile() публичный Метод

Transmits a file to the web server stated in the URL property. You may call this several times and it will use the values previously set for fields and URL.
public sendFile ( string aFilename, CookieContainer cookies ) : void
aFilename string The full path of file being transfered.
cookies System.Net.CookieContainer
Результат void

sendFile() публичный Метод

public sendFile ( string aFilename, Stream readIn, CookieContainer cookies ) : void
aFilename string
readIn Stream
cookies System.Net.CookieContainer
Результат void

sendFile() публичный Метод

public sendFile ( string aFilename, byte data, CookieContainer cookies ) : void
aFilename string
data byte
cookies System.Net.CookieContainer
Результат void

setField() публичный Метод

Allows you to add some additional field data to be sent along with the transfer. This is usually used for things like userid and password to validate the transfer.
public setField ( string key, string str ) : void
key string The form field name
str string The form field value
Результат void

setFilename() публичный Метод

Used to signal we want the output to go to a text file verses being transfered to a URL.
public setFilename ( string path ) : void
path string
Результат void

writeString() публичный Метод

Mainly used to turn the string into a byte buffer and then write it to our IO stream.
public writeString ( System io, string str ) : void
io System The io stream for output.
str string The data to write.
Результат void

Описание свойств

coRequest защищенное свойство

Used mainly to avoid passing parameters to other routines. Could have been local to sendFile().
protected HttpWebRequest,System.Net coRequest
Результат System.Net.HttpWebRequest