These are chat archives for esp8266/Arduino

25th
Jun 2018
Luc
@luc-github
Jun 25 2018 19:48
Hi is there a way to access post arguments when file is uploading ?
like to get the size of the processing file in previous argument to verify upload is correct,
It seems it is possible with Asyncwebserver but not with esp8266 one.
I see arguments are in temporary array , and there are several copies done on it which is very confusing :
https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WebServer/src/Parsing.cpp#L554-L572
any guru can give some tips ?
thank you
den har
@denman0000_gitlab
Jun 25 2018 20:06
@luc-github Hi Luc ... perhaps search for checksum SPIFFS .. ? Have you posted on stackoverflow yet ?
Luc
@luc-github
Jun 25 2018 20:16
Well upload is not only for SPIFFS can be for SD too or any upload , no I did not posted on stackoverflow
den har
@denman0000_gitlab
Jun 25 2018 20:19
I would post that code part at stack .. and also look for a chap called Ash here
Luc
@luc-github
Jun 25 2018 20:30
Thank you ^_^ but that code is not mine it is ESP8266 core lib - going to another place to ask question about core code is weird IMHO
I can do PR to work around - but I prefer to ask question first
den har
@denman0000_gitlab
Jun 25 2018 20:54
@luc-github I understand .. was just trying to help
Martin Ayotte
@martinayotte
Jun 25 2018 21:02
@luc-github , WebServer provide methods such srv.hasArg(String) to see if specific argument is present and value can be retrieve using srv.arg(String)
den har
@denman0000_gitlab
Jun 25 2018 21:07
Hi all .. would anyone here happen to know where I can find more info about the format of this line
server.send(200, "text/html", "<form action=\"/LED\" method=\"POST\"><input type=\"submit\" value=\"Toggle LED\"></form>" "<form action=\"/RELAY\" method=\"POST\"><input type=\"submit\" value=\"Toggle RELAY\"></form>" "<form action=\"/BOTH\" method=\"POST\"><input type=\"submit\" value=\"Toggle BOTH\"></form>");}
Its not working and I would like to have 3 buttons that work, I'm used to HTML but cant figure out how to set the escape sequences and whether or not I need commas between the <form></form> tags
Martin Ayotte
@martinayotte
Jun 25 2018 21:12
@denman0000_gitlab , server.send() third argument should be only 1 string, not multiple like shown in your post. (btw, HTML also accept single quotes, so no needs to get double quotes using escaping)
den har
@denman0000_gitlab
Jun 25 2018 21:13
@martinayotte thank you kindly for the reply .. not quite sure what you're pointing out ?
this :
'<form action=\"/LED\" method=\"POST\"><input type=\"submit\" value=\"Toggle LED\"></form>
Martin Ayotte
@martinayotte
Jun 25 2018 21:15
server.send(200, "text/html", "<form action='/LED' method='POST'><input type='submit' value='Toggle LED'></form><form action='/RELAY' method='POST'><input type='submit' value='Toggle RELAY'></form><form action='/BOTH' method='POST'><input type='submit' value='Toggle BOTH'></form>");
den har
@denman0000_gitlab
Jun 25 2018 21:15
"<form action=\"/LED\" method=\"POST\"><input type=\"submit\" value=\"Toggle LED\"></form><form action=\"/RELAY\" method=\"POST\"><input type=\"submit\" value=\"Toggle RELAY\"></form><form action=\"/BOTH\" method=\"POST\"><input type=\"submit\" value=\"Toggle BOTH\"></form>"
hahaha :-) almost snap :-) @martinayotte thank you kinldy
Luc
@luc-github
Jun 25 2018 21:16
@denman0000_gitlab yes I know thank you
@martinayotte yes but the arg array using these function is filled only at the end of all post arguments processed - the temporary array which is filled during the process is not available
den har
@denman0000_gitlab
Jun 25 2018 21:16
so you dont need the Escape characters there
?
Martin Ayotte
@martinayotte
Jun 25 2018 21:17
no
den har
@denman0000_gitlab
Jun 25 2018 21:17
@martinayotte what was confusing me was the ESCAPES
Martin Ayotte
@martinayotte
Jun 25 2018 21:17
@luc-github , what do you mean by "filled only at the end of all post arguments processed"
Me No Dev
@me-no-dev
Jun 25 2018 21:19
@martinayotte means that you do not have access to the collected argument untill the request has been received
remenence from the early "design" of the server
Luc
@luc-github
Jun 25 2018 21:20
Yes - and this copie https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WebServer/src/Parsing.cpp#L554-L572 is really weird - or I am dumb (most likely possible)
Me No Dev
@me-no-dev
Jun 25 2018 21:22
@luc-github might be combining GET and POST parameters
Luc
@luc-github
Jun 25 2018 21:25
can get POST and GET arguments in same query ?
Me No Dev
@me-no-dev
Jun 25 2018 21:26
yes if you POST to /url?getarg=getval
Luc
@luc-github
Jun 25 2018 21:29
Ok - I did not imagined that case
I was thinking to get read access to the temporary array postArgs to not break the current code as this part is little bit tricky
Chris Dalby
@moose4621
Jun 25 2018 21:32
@denman0000_gitlab Did you get it working?
den har
@denman0000_gitlab
Jun 25 2018 21:39
@moose4621 Hello Chris .. how are you man ? I'm busy trying it now :-)
@moose4621 Hold thumbs ... and standby for update
@moose4621 Plugging into AC now
den har
@denman0000_gitlab
Jun 25 2018 21:45
@moose4621 same issue :-(
Chris Dalby
@moose4621
Jun 25 2018 21:46
Check in private chat.