I am working on a project that requires me to upload files from the PC (wav, doc, excel) to an embedded web server running on an ARM cortex TI TM4C chip. I have beginner html and javascript skills. Could you please point me to the right direction because I am clueless on what to do next. This is what I have done based what I have researched so far. Below is a simple HTML code that allows me to upload a simple text file. It looks like I could do it with a text file. Please see the output below the HTML. But when I try uploading a doc or a wav file. I don't see the contents being transferred. Thank you very much for the help.
Regards, Jay
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>File Transfer</title>
<!------------------------>
<style>
body {
width: 305px;
margin: 0 auto;
background-color: #ccc;
}
</style>
<!------------------------>
</head>
<body>
<h1>File Transfer</h1>
<p><img src="pic.jpg" alt="First-In"></p>
<form method='POST' enctype='multipart/form-data' action='fup.cgi'>
<p>Upload file</p>
<input type="file" name="File" value="File">
<p></p>
<input type="submit" name="Upload" value="Upload">
</form>
</body>
</html>
It looks like I was able to make a simple text file to upload. Here is the output from the serial port connected to the TI MCU
Message = POST /fup.cgi HTTP/1.1
Referer: http://10.20.30.120/File_Transfer.html?File+Transfer=File+Transfer
Cache-Control: max-age=0
Content-Type: multipart/form-data; boundary=---------------------------7e259540702
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134
Accept-Language: en-US
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Upgrade-Insecure-Requests: 1
Accept-Encoding: gzip, deflate
Host: 10.20.30.120
Content-Length: 286
Connection: Keep-Alive
-----------------------------7e259540702
Content-Disposition: form-data; name="File"; filename="Test.txt"
Content-Type: text/plain
Hello
-----------------------------7e259540702
Content-Disposition: form-data; name="Upload"
Upload
-----------------------------7e259540702--
Number of bytes received = 866
This is what I see whenever I upload a wav or doc file. No contents of the file is displayed
Message = POST /fup.cgi HTTP/1.1
Referer: http://10.20.30.120/File_Transfer.html?File+Transfer=File+Transfer
Cache-Control: max-age=0
Content-Type: multipart/form-data; boundary=---------------------------7e230c2040702
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134
Accept-Language: en-US
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Upgrade-Insecure-Requests: 1
Accept-Encoding: gzip, deflate
Host: 10.20.30.120
Content-Length: 12183
Connection: Keep-Alive
Number of bytes received = 584
Aucun commentaire:
Enregistrer un commentaire