Build Your Own Arcade Controls Forum
Main => Software Forum => Topic started by: Howard_Casto on January 21, 2014, 05:01:48 am
-
A couple of my projects have made me realize that it might just be simpler to byte the bullet and make a webserver from scratch.
A slight snag I've been having are the "Content-type:" definitions you need to supply when sending along a file. There are various lists out there, but most are either incomplete or aren't very copy/paste friendly.
Any of you guys have a good list or a link to a good one?
-
I've run LAMP for years with downloads and have never worried about content-type that I can recall. What specific snag are you hitting?
-
Not a snag per say... it's just that android, particularly the older versions, seems to be quite picky. It'll try to download and save things as a file that should normally be displayed in browser. It seems to be an android exclusive problem, but I'll bet other non-standard browsers are going to have issues as well. I've got all of the common ones hooked up, but I'd like to just be done with it and lookup from a list.
-
Ah, have not pissed around with Android at all. Bought a book to help program a game on one.......then saw game already existed..........haven't looked back. :P
-
Not a snag per say... it's just that android, particularly the older versions, seems to be quite picky. It'll try to download and save things as a file that should normally be displayed in browser. It seems to be an android exclusive problem, but I'll bet other non-standard browsers are going to have issues as well. I've got all of the common ones hooked up, but I'd like to just be done with it and lookup from a list.
I'm not sure if you ever got this working but you'll want to leave content-type as it is. to force download you'll need to set "Content-Disposition: attachment;" in the header...
alternatively you can force set this for certain file types in the apache config:
<FilesMatch "\.(?i:doc|odf|pdf|rtf|txt)$">
Header set Content-Disposition attachment
</FilesMatch>
This is the proper way to do this, but sometimes the browser still ignores it.
-
You want this:
http://en.wikipedia.org/wiki/Internet_media_type (http://en.wikipedia.org/wiki/Internet_media_type)
What the heck projects are making you need to create a web server? :)
edit: forgot to mention.. in Android it is on an app to say whether or not they handle certain MIME types.. particularly older Android web browsers didn't handle all of them - so you will run into that issue. If anyone is using an older version of Android, they should probably not be using the stock web browser.