[En-Nut-Discussion] File upload via Http

Lars Andersson lakab at telia.com
Thu Mar 31 22:39:09 CEST 2005


Hi Vesa, 
I saw your previous posting on this subject, POST method, I also
tried to implement it, but it was to advanced for me, I got lost.
It is very interesting to have the post mechanism, I use GET 
now but need longer strings that post will provide.
Thank you for implementing it.

I am embarrassed to ask, guess I should be able to find out
myself, but how do I "apply patch #1164563 from tracker" ??

Regards,
Lars H. Andersson 
  

> -----Original Message-----
> From: en-nut-discussion-bounces at egnite.de 
> [mailto:en-nut-discussion-bounces at egnite.de] On Behalf Of 
> Vesa Jääskeläinen
> Sent: Thursday, 31 March, 2005 14:58
> To: Ethernut User Chat (English)
> Subject: Re: [En-Nut-Discussion] File upload via Http
> 
> 
> Ralf Spettel wrote:
> > Hi, thx for your answers. My problem is not to send the 
> file. I want to 
> > know, how can I access the transmitted data.
> > Is there a funktion in th eOS which support the HTTP-POST method an 
> > delivers a pointer to the received data..
> > 
> >  Ralf
> 
> There is no built in support for this, but you could apply patch 
> #1164563 from tracker and then do something like this:
> 
>      if (req->req_method == METHOD_POST)
>      {
>          char *line;
>          int pos;
>          int ch;
> 
> 	// Limit data to maximum of 4096 characters
>          if (req->req_length > 4096) req->req_length = 4096;
> 
>          if ((line = NutHeapAlloc(req->req_length+1)) != 0)
>          {
>              for (pos = 0; pos < req->req_length; pos++)
>              {
>                  ch = fgetc(stream);
>                  if (ch == EOF) break;
> 
>                  line[pos] = ch;
>              }
> 
> 	    // process data here...
> 
>              NutHeapFree(line);
> 	}
>      }
> 
> Thanks,
> Vesa Jääskeläinen
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
> 





More information about the En-Nut-Discussion mailing list