[En-Nut-Discussion] Send File via HTTP POST request

András Szemző szemzo.andras at gmail.com
Wed Jan 20 14:00:32 CET 2010


on your registered upload.cgi you can do something like

	if (req->req_method == METHOD_POST) {
		
		while ( fgets(buf, BUF_SIZE, stream) > 0 ) 
			printf(buf);
	
	}

And you will see how the data will look like.

Andras



On Jan 20, 2010, at 12:47 PM, Goddchen wrote:

> Hey,
> thanks for your fast answers :)
> ok then i need to parse the post data on my own, ok. but: how do i get the
> post data? the stream that i need to parse? is it somewhere in the REQUEST
> struct? since all i get is the callback static int handlePOST(FILE * stream,
> REQUEST * req). where stream is the response stream and req should hold the
> parameters which it doesn't. or does it?
> how can i get the POST stream?
> 
> Greets, Goddchen
> 
> --
> Mit freundlichen Grüßen
> Martin Liersch
>> Blog: http://blog.goddchen.de
>> Website: http://www.goddchen.de
> 
> 
> 
> Hi,
>> 
>> Something like that:
>> 
>> fputs_P("<form action='/cgi-bin/upload.cgi' method='POST'
>> enctype='multipart/form-data'>File: <input name='inputfile' type='file'
>> size='30'><br><INPUT TYPE='submit' VALUE='Upload'></form>", stream);
>> 
>> With the registered upload.cgi you should not use a
>> NutHttpProcessPostQuery() or NutHttpGetParameterCount() functions,
>> becouse the uploaded data will be MULTIPART, separated by boundary.
>> Instead you should write your own parser. First find the boundary, and than
>> process your file read between the boundaries.
>> 
>> 
>> On Jan 19, 2010, at 5:25 PM, Goddchen wrote:
>> 
>>> Hey everybody,
>>> i need to send a file to NutOS via HTTP Post request. Therefore i need to
>>> specify the "multipart/form-data" enctype in my html form. Unfortunately
>>> NutOS won't understand that enctype and NutHttpGetParameterCount returns
>> 0
>>> :(
>>> How can i send a file to NutOS via HTTP POST request? Any ideas?
>>> 
>>> Greets, Goddchen
>>> _______________________________________________
>>> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>> 
>> 
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion




More information about the En-Nut-Discussion mailing list