Hello, I am currently working with Keil uVision4 and RL-ARM. The microprocessor used is a LPC2468. I have a problem with the webserveur. I try to display a SVG file in a web page. This is the code of my web page:
<html> <head></head> <body> <object data="b.svg" type="image/svg+xml" width="800" height="600" > <p> b.svg not available </p> </object> </body> </html>
And the code of the file b.svg:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "">www.w3.org/.../svg11.dtd"> <svg xmlns="">http://www.w3.org/2000/svg" version="1.1" width="300" height="200"> <title>Title</title> <desc> Description </desc> <rect width="100" height="80" x="0" y="70" fill="green" /> <line x1="5" y1="5" x2="250" y2="95" stroke="red" /> <circle cx="90" cy="80" r="50" fill="blue" /> <text x="180" y="60"> Un texte </text> </svg>
I also use external flash with uffs (unified flash file system) and I think that the problem is due to functions “http_fopen, http_fclose, http_fread, http_fgets” describe in the file HTTP_uif.c, because when I analyze the content-type of the Keil webserveur reply I have this information:
- Server: Keil-EWEB/2.1 - Content-Type: application/octet-stream - Last-Modified: Tue, 10 May 2011 08:02:44 GMT - Connection: close
Furthermore, SVG file in save in the external FLASH, but I tried to store in the RAM (like a web page) and the result is the same.
For a SVG file the content type should be “image/svg+xml”. I also tried with a TXT file type and I have the problem, the content type stays the same: application/octet-stream. Do you have an idea to solve my problem? How fix content type for a Keil webserveur reply ?
The content type for various file types is built into the library. TCPnet has no knowledge of .svg or .svgz files (yet), so it sends a generic Content-Type for unknown content / binary files.
Please ask keil support for the updated library that fixes this problem.
Thanks you for you quickly response. I agree with you, but do you think is normal that I have the same problem with a file text (.txt) ?
I contacted Keil support. Wait and see !
The library should have some support for a user-defined table since it's impossible to have hard-coded whatever MIME string that a user may need.
Hi,
Have a look at cgx_content_type() this is change Franc did for us to support use of MS Silverlight again had different content type. Think might restrict you to cgx files, but could be possible work around and also http_get_content_type()
Cheers Darren
I solve my problem with this solution: rename svg file in xml file and use the tag
<object data=”file.xml” type=”image/svg+xml” />.
Thanks for your replies.