473,804 Members | 2,119 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Flash (SWF) from Web Server

I'm creating a webserver to run from a CD. I've found
http://www.adp-gmbh.ch/win/misc/webserver.html which is my starting
block. I've really made two modifications. First adding the
appropriate content-type in the headers whether I'm delivering
html/css/jpeg/etc. The second is reading those simple html/css files
as opposed to having the html hard coded. My problem occurs when
trying to display flash files. I am also only able to reproduce the
problem in IE, not Firefox. Trying to view the swf prompts for a
download of the file, which does fail if you try it. I know this isn't
some setting in IE b/c other swf's load fine.

My best guess is how I'm reading the files?

I've included below the two code modifications from the original
source.

main.cpp....... ... Read Files instead of hard coding html

std::string strLine;
std::string strResponse;
std::string strChapter = r->path_;
ifstream objFile;

// COMMENT: Process Empty Request
if (strChapter == "/")
{ strChapter = "/index.htm"; }

// COMMENT: Add TSLM Directory, Remove Leading Slash
strChapter = "tslm\\" + strChapter.subs tr(1,strChapter .length());

// COMMENT: Open File
objFile.open(st rChapter.c_str( ), ios::out | ios::binary);
if (objFile.is_ope n())
{

// COMMENT: Loop Through File
while (!objFile.eof() )
{
getline (objFile,strLin e);
strResponse += strLine + "\n";
}

// COMMENT: Close Binary Connection
objFile.close() ;
}
else
{ strResponse = ""; }

// COMMENT: Return Response
r->answer_ = strResponse;
WebServer.cpp.. .... Fixed Content-Type Headers...

// COMMENT: Determine Content Type
if(strExt == (".htm") || strExt == (".html"))
strType = "text/html";
else if(strExt == (".css"))
strType = "text/css";
else if(strExt == (".js"))
strType = "applicatio n/x-javascript";
else if(strExt == (".swf"))
strType = "applicatio n/x-shockwave-flash";
else if(strExt == (".txt"))
strType = "text/plain";
else if(strExt == (".jpg") || strExt == (".jpeg"))
strType = "image/jpeg";
else if(strExt == (".gif"))
strType = "image/gif";
else
strType = "applicatio n/octet-stream";
Any help or insight as to why this fails would be more than appreciated!

Oct 17 '06 #1
3 2039

ea********@gmai l.com wrote:
I'm creating a webserver to run from a CD. I've found
http://www.adp-gmbh.ch/win/misc/webserver.html which is my starting
block. I've really made two modifications. First adding the
appropriate content-type in the headers whether I'm delivering
html/css/jpeg/etc. The second is reading those simple html/css files
as opposed to having the html hard coded. My problem occurs when
trying to display flash files. I am also only able to reproduce the
problem in IE, not Firefox. Trying to view the swf prompts for a
download of the file, which does fail if you try it. I know this isn't
some setting in IE b/c other swf's load fine.

My best guess is how I'm reading the files?

I've included below the two code modifications from the original
source.

main.cpp....... ... Read Files instead of hard coding html

std::string strLine;
std::string strResponse;
std::string strChapter = r->path_;
ifstream objFile;

// COMMENT: Process Empty Request
if (strChapter == "/")
{ strChapter = "/index.htm"; }

// COMMENT: Add TSLM Directory, Remove Leading Slash
strChapter = "tslm\\" + strChapter.subs tr(1,strChapter .length());

// COMMENT: Open File
objFile.open(st rChapter.c_str( ), ios::out | ios::binary);
objFile.open(st rChapter.c_str( ), ios::in | ios::binary);
if (objFile.is_ope n())
{

// COMMENT: Loop Through File
while (!objFile.eof() )
{
getline (objFile,strLin e);
strResponse += strLine + "\n";
}

// COMMENT: Close Binary Connection
objFile.close() ;
}
else
{ strResponse = ""; }

// COMMENT: Return Response
r->answer_ = strResponse;
WebServer.cpp.. .... Fixed Content-Type Headers...

// COMMENT: Determine Content Type
if(strExt == (".htm") || strExt == (".html"))
strType = "text/html";
else if(strExt == (".css"))
strType = "text/css";
else if(strExt == (".js"))
strType = "applicatio n/x-javascript";
else if(strExt == (".swf"))
strType = "applicatio n/x-shockwave-flash";
else if(strExt == (".txt"))
strType = "text/plain";
else if(strExt == (".jpg") || strExt == (".jpeg"))
strType = "image/jpeg";
else if(strExt == (".gif"))
strType = "image/gif";
else
strType = "applicatio n/octet-stream";
Any help or insight as to why this fails would be more than appreciated!
Oct 17 '06 #2

ea********@gmai l.com wrote:
I'm creating a webserver to run from a CD. I've found
http://www.adp-gmbh.ch/win/misc/webserver.html which is my starting
block. I've really made two modifications. First adding the
appropriate content-type in the headers whether I'm delivering
html/css/jpeg/etc. The second is reading those simple html/css files
as opposed to having the html hard coded. My problem occurs when
trying to display flash files. I am also only able to reproduce the
problem in IE, not Firefox. Trying to view the swf prompts for a
download of the file, which does fail if you try it. I know this isn't
some setting in IE b/c other swf's load fine.

My best guess is how I'm reading the files?

I've included below the two code modifications from the original
source.

main.cpp....... ... Read Files instead of hard coding html
<snip>
>
// COMMENT: Loop Through File
while (!objFile.eof() )
{
getline (objFile,strLin e);
strResponse += strLine + "\n";
}
<snip>
Any help or insight as to why this fails would be more than appreciated!
I don't know if it has anything to do with what you're seeing, but you
say you suspect that how you read the files might be the problem. One
thing leapt out:

while (!objFile.eof() )

is not how you use eof when reading from a stream.
http://www.parashift.com/c++-faq-lit....html#faq-15.5

Gavin Deane

Oct 17 '06 #3
You're right, that should be ios::in

I've corrected that but actually posted a slightly older version of my
code. Thank you though!

On Oct 17, 6:13 pm, "Salt_Peter " <pj_h...@yahoo. comwrote:
earl.bo...@gmai l.com wrote:
I'm creating a webserver to run from a CD. I've found
http://www.adp-gmbh.ch/win/misc/webserver.htmlwhich is my starting
block. I've really made two modifications. First adding the
appropriate content-type in the headers whether I'm delivering
html/css/jpeg/etc. The second is reading those simple html/css files
as opposed to having the html hard coded. My problem occurs when
trying to display flash files. I am also only able to reproduce the
problem in IE, not Firefox. Trying to view the swf prompts for a
download of the file, which does fail if you try it. I know this isn't
some setting in IE b/c other swf's load fine.
My best guess is how I'm reading the files?
I've included below the two code modifications from the original
source.
main.cpp....... ... Read Files instead of hard coding html
std::string strLine;
std::string strResponse;
std::string strChapter = r->path_;
ifstream objFile;
// COMMENT: Process Empty Request
if (strChapter == "/")
{ strChapter = "/index.htm"; }
// COMMENT: Add TSLM Directory, Remove Leading Slash
strChapter = "tslm\\" + strChapter.subs tr(1,strChapter .length());
// COMMENT: Open File
objFile.open(st rChapter.c_str( ), ios::out | ios::binary); objFile.open(st rChapter.c_str( ), ios::in | ios::binary);
if (objFile.is_ope n())
{
// COMMENT: Loop Through File
while (!objFile.eof() )
{
getline (objFile,strLin e);
strResponse += strLine + "\n";
}
// COMMENT: Close Binary Connection
objFile.close() ;
}
else
{ strResponse = ""; }
// COMMENT: Return Response
r->answer_ = strResponse;
WebServer.cpp.. .... Fixed Content-Type Headers...
// COMMENT: Determine Content Type
if(strExt == (".htm") || strExt == (".html"))
strType = "text/html";
else if(strExt == (".css"))
strType = "text/css";
else if(strExt == (".js"))
strType = "applicatio n/x-javascript";
else if(strExt == (".swf"))
strType = "applicatio n/x-shockwave-flash";
else if(strExt == (".txt"))
strType = "text/plain";
else if(strExt == (".jpg") || strExt == (".jpeg"))
strType = "image/jpeg";
else if(strExt == (".gif"))
strType = "image/gif";
else
strType = "applicatio n/octet-stream";
Any help or insight as to why this fails would be more than appreciated!
Oct 17 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1707
by: Rick | last post by:
hi guys!! i saw recently a document explaining how to send ""events"" from a flash swf to a .net app using C#, now im interested in know if is possible to send "events" from my app .net using C# o VB or J# to the same flash movie without use a web server, flash remoting, orbe or aspx, php, etc
9
8609
by: Keith Rowe | last post by:
Hello, I am trying to reference a Shockwave Flash Object on a vb code behind page in an ASP.NET project and I receive the following error: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). On the aspx page I have the object tag as follows:
3
5576
by: Mike | last post by:
I have a simple flash file that plays within a webform of an asp.net app. When running from the server the flash file works fine. But when I run it from my localhost the flash file simply doesn't play. I have Flash installed on my localhost, and I'm not sure why its not working. Is there a setting somewhere in IIS or the computer's Extensions of my localhost which may be preventing it from playing? Before posting my code which...
5
1985
by: JJ | last post by:
Although this question involves Flash, I suspect the actual issue is an asp one.. I am trying to open the web.sitemap file in an .swf file enbedded in an asp page (I'm working in VS 2005). I get an error in Flash when it trys to open this file using standard Flash commands. However when I change the file name and command to 'Web.xml' it works. (it also works if I don't change the name, but run the swf in flash player and not via the...
2
3553
by: avanhalen | last post by:
To embed flash objects in my pages, I read them from a database. A script file (Filedownload.aspx) reads it from the database, and streams it to the browser. Here are two example flash objects in a page. The first 1 (a simple link to an existing swf-file on the webserver) is showing in each browser (IE & FF), while the other one (using the filedownload page) is only being shown in FF. Does it have something to do with file-extension?
0
2046
by: fblake | last post by:
Active Flash V1.0 http://www.activeup.com/products/components/activeflash Price - $295 Evaluation - http://dl.filekicker.com/send/file/184524-5045/ActiveFlash1.zip
12
2420
by: Sandman | last post by:
There are some Mac tools to convert pretty much any given video source to a Flash video file (.flv) but I'm wondering if there is any way to do it using a Linux platform tying in to a PHP web system? I.e. I'd like to have video files submitted by users which are then auto-converted to .flv files. Anyone have any experience with this? -- Sandman
1
3802
by: redet | last post by:
A demo created by a person who has since left, runs fine on a local (Windows XP) system within flash player 8, but when we try to access it through the html version (index.html) on a local system or on our server, there is a breakdown when it tries to load .FLV files sequentially. All the files share the same directory. There are no 'subfolders', all files are in the same root folder called group_quote. Given that the sequential loading...
8
5916
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web clients (Internet Explorer). My flash content was originally brought in via the “flash satay” method, but I have since used some server-side magic do deliver one <objecttag
2
2407
by: lionbarrage | last post by:
Hi all, I was just wondering if anyone knows how to grab an image from a flv or a swf when a user uploads a file? Any help would be appreciated!
0
9715
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10352
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10354
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10097
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9175
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7642
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5535
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.