lvillani's picture

Is it possible to deal with this type of forms easily? If yes what are the Classes/Methods to use?
I'd like to add the file upload feature to my application easily. If there's no way to do that with Pion is it possible to implement this feature?

PS: while playing with HTTPRequest object I noticed that while getContentLength() returns a certain value, getContent does not return all data.
For example, if I make a POST request of a form with a couple of text fields and an uploaded file getContentLength returns the right size of the request while getContent returns only a part of it. In my case getContentLength returns ~27KB of data, getContent returns only 279 bytes.

Thanks in advance

Mike Dickey's picture
multipart/form-data not supported

This encoding type is not currently supported by the network library. There is a ticket created for this but no one currently working on it:

http://trac.atomiclabs.com/ticket/16

If you or someone else would like to write a patch, we'd be happy to consider merging it in.

The size of the actual buffer should match getContentLength(). I suspect that your problem with getContent() may be that there is a null character in the payload buffer (perhaps within the file content?).

Submitted by Mike Dickey on Tue, 07/29/2008 - 14:36.
lvillani's picture
Is it possible to avoid that

Is it possible to avoid that the null character compromises the getContent() data?

Submitted by lvillani on Wed, 07/30/2008 - 01:48.
Mike Dickey's picture
It shouldn't

A null or any other binary character in the payload content should not affect getContent() or getContentSize(). From the library's perspective, the content is just a collection of bytes. getContent() just returns a pointer to the memory block.

Submitted by Mike Dickey on Sat, 08/09/2008 - 15:58.