Hello,
i want to build a simple Web-Server on the Teensy 3.5.
I can successfully send my content, e.g. .css, .html, etc. files over Ethernet to a webbroswer from a SD-Card.
But trying to upload data to the teensy doesn't work over html. Seems, like the browser just doesn't upload the files.
I'd like to upload some data over a browser to simply update files on a SD-Card.
i am using pauls ethernet library for data transfer.
the html-code for uploading is e.g. this:
-----------------------
my reading code, just to monitor the incomming data is this:
----------------------------
the result in the serial monior is this:
CHROME:
Question:
when selecting a file (e.g a simple .txt file) in the browser an hitting the "submit" button, as shown, no data is uploaded through firefox.
Can some help me with this issue please? =(
Greetings,
Welcos
i want to build a simple Web-Server on the Teensy 3.5.
I can successfully send my content, e.g. .css, .html, etc. files over Ethernet to a webbroswer from a SD-Card.
But trying to upload data to the teensy doesn't work over html. Seems, like the browser just doesn't upload the files.
I'd like to upload some data over a browser to simply update files on a SD-Card.
i am using pauls ethernet library for data transfer.
the html-code for uploading is e.g. this:
Code:
<form method="POST" enctype="multipart/form-data" action="">
<div class="form-group">
<hr />
<label for="exampleInputFile">File input</label>
<input type="file" class="form-control-file" id="exampleInputFile" aria-describedby="fileHelp">
<small id="fileHelp" class="form-text text-muted">This is some placeholder block-level help text for the above input. It's a bit lighter and easily wraps to a new line.</small>
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
my reading code, just to monitor the incomming data is this:
Code:
EthernetClient client;
void htmlServer() {
// listen for incoming clients
static uint32_t numberClient = 0;
static unsigned long timeStamp;
unsigned long timeout;
static boolean isTimeout = false;
client = server.available();
if (client) {
htmlServerClientRead(numberClient);
numberClient++;
timeStamp = millis(); // reset timeout;
isTimeout = false;
}
timeout = millis() - timeStamp;
if ((timeout > 2000) && !isTimeout) { // reset numberClient after 2 seconds
Serial.print("---timeout---\n\n\n");
numberClient = 0;
isTimeout = true;
}
}
void htmlServerClientRead(uint32_t numberClient) {
boolean trasmissionDone = false;
#ifdef htmlServerMsg
Serial.println("new client");
#endif // htmlServerMsg
while (client.connected()) {
if (client.available()) {
Serial.write(client.read());
}
}
delay(1);
// close the connection:
Serial.print("Closing conntection...\n");
client.stop();
#ifdef htmlServerMsg
Serial.println("client disconnected");
#endif // htmlServerMsg
}
the result in the serial monior is this:
CHROME:
Code:
new client
POST /html/index.html HTTP/1.1
Host: 192.168.0.31
Connection: keep-alive
Content-Length: 44
Cache-Control: max-age=0
Origin: http://192.168.0.31
Upgrade-Insecure-Requests: 1
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary6j0B6fY22Ij7A4Bb
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://192.168.0.31/html/index.html
Accept-Encoding: gzip, deflate
Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
------WebKitFormBoundary6j0B6fY22Ij7A4Bb--
Closing conntection...
client disconnected
---timeout---
Question:
when selecting a file (e.g a simple .txt file) in the browser an hitting the "submit" button, as shown, no data is uploaded through firefox.
Can some help me with this issue please? =(
Greetings,
Welcos