C++ cgi to serve media files from diferent path of document root.
Main ideas:
receive id from query_string: [login to view URL]
generate a md5hash with media value, in this example generate a md5hash from 1,
this hash is a name of media file (always application/x-shockwave-flash) in another dir in server...
open and read media file content, the data is encoded in base64.. decode and send to brownser
Python Example:
import cgi
import hashlib
import base64
import os
media_dir="c:\\media"
form = [login to view URL]()
file_to_serve= "%s\\%s" % (media_dir,[login to view URL](form["media"].value).hexdigest())
print "Content-Type: application/x-shockwave-flash\n\n"
print [login to view URL](file(file_to_serve, "rb").read())
I have a html page, where a get this cgi to show flash media, like.
<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0">
<param name="movie" value="http://localhost/[login to view URL]; />';
<param name="wmode" value="transparent" />';
<param name="quality" value="high" />';
<embed src="http://localhost/[login to view URL]; quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" type="application/x-shockwave-flash"></embed>';
</object>
The cgi must run in [login to view URL] webserver...
Project must delivered with binary to run in all windows (32/64bits) and sources, to compile with gcc, ou another opensource compiler.