473,796 Members | 2,904 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Outputting an rtf to browser

Hi all, I'm just trying to send a rtf file to the browser but firefox
and IE just display raw rtf content (with tags and so on)...
I used this code down below:

--CODE

$length = strlen($new_rtf );

$filename = "certificato_". $paz.".rtf";

header("Content-Type: application/rtf");

header("Content-Length: ".$length);

header("Content-Disposition:att achment; filename=\"".$f ilename."\"");

echo($new_rtf);

--END

Actually it's in a page with no HTML tags, I don't know if this is an
error or what...Can anybody help me?
Aug 30 '08 #1
8 6994
Peter:
header("Content-Type: application/rtf");
The registered MIME type for RTF is text/rtf.

http://www.iana.org/assignments/media-types/

--
Jock
Aug 30 '08 #2
John Dunlop ha scritto:
Peter:
> header("Content-Type: application/rtf");

The registered MIME type for RTF is text/rtf.

http://www.iana.org/assignments/media-types/

--
Jock
thank you so much, but still not works...I don't know why. Should I
put headers between <headhtml tags?
Aug 30 '08 #3
Peter schreef:
Hi all, I'm just trying to send a rtf file to the browser but firefox
and IE just display raw rtf content (with tags and so on)...
I used this code down below:

--CODE

$length = strlen($new_rtf );

$filename = "certificato_". $paz.".rtf";

header("Content-Type: application/rtf");

header("Content-Length: ".$length);

header("Content-Disposition:att achment; filename=\"".$f ilename."\"");

echo($new_rtf);

--END

Actually it's in a page with no HTML tags, I don't know if this is an
error or what...Can anybody help me?
you use '$filename' and '$new_rtf'

Which of them contains the file you want to send to the browser?

--
Luuk
Aug 30 '08 #4
Luuk ha scritto:
Peter schreef:
>Hi all, I'm just trying to send a rtf file to the browser but firefox
and IE just display raw rtf content (with tags and so on)...
I used this code down below:

--CODE

$length = strlen($new_rtf );

$filename = "certificato_". $paz.".rtf";

header("Content-Type: application/rtf");

header("Content-Length: ".$length);

header("Content-Disposition:att achment; filename=\"".$f ilename."\"");

echo($new_rtf);

--END

Actually it's in a page with no HTML tags, I don't know if this is an
error or what...Can anybody help me?

you use '$filename' and '$new_rtf'

Which of them contains the file you want to send to the browser?

$filename is just a string containing file's name, while $new_rtf is
the reference to the file
Aug 30 '08 #5
Peter schreef:
Luuk ha scritto:
>Peter schreef:
>>Hi all, I'm just trying to send a rtf file to the browser but firefox
and IE just display raw rtf content (with tags and so on)...
I used this code down below:

--CODE

$length = strlen($new_rtf );

$filename = "certificato_". $paz.".rtf";

header("Content-Type: application/rtf");

header("Content-Length: ".$length);

header("Content-Disposition:att achment; filename=\"".$f ilename."\"");

echo($new_rtf);

--END

Actually it's in a page with no HTML tags, I don't know if this is an
error or what...Can anybody help me?

you use '$filename' and '$new_rtf'

Which of them contains the file you want to send to the browser?


$filename is just a string containing file's name, while $new_rtf is the
reference to the file
1 <?php
2
3 $filename = "test.rtf";
4 $length = strlen($filenam e);
5 header("Content-Type: application/rtf");
6 header("Content-Length: ".$length);
7 header("Content-Disposition:att achment; filename=\"".$f ilename."\"");
8
9 echo($filename) ;
10
11 ?>

worked for me....

--
Luuk
Aug 30 '08 #6
Peter wrote:
Hi all, I'm just trying to send a rtf file to the browser but firefox
and IE just display raw rtf content (with tags and so on)...
I used this code down below:

--CODE

$length = strlen($new_rtf );

$filename = "certificato_". $paz.".rtf";

header("Content-Type: application/rtf");

header("Content-Length: ".$length);

header("Content-Disposition:att achment; filename=\"".$f ilename."\"");

echo($new_rtf);

--END

Actually it's in a page with no HTML tags, I don't know if this is an
error or what...Can anybody help me?
You can recommend dispositions, but the browser is free to ignore them.

However, in your case, I suspect something else is going on. First of
all, enable all errors and display them - in your php.ini file, put:

display_errors= on
error_reporting =E_ALL

And restart your web server.

If that doesn't show anything, look at the headers being sent by the web
server - the "Live HTTP Headers" add-on for Firefox is great in this
respect.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Aug 30 '08 #7
In article <48************ ***********@rea der4.news.tin.i t>,
Peter <zigozago@myhom ewrote:
Hi all, I'm just trying to send a rtf file to the browser but firefox
and IE just display raw rtf content (with tags and so on)...
I used this code down below:

--CODE

$length = strlen($new_rtf );

$filename = "certificato_". $paz.".rtf";

header("Content-Type: application/rtf");

header("Content-Length: ".$length);

header("Content-Disposition:att achment; filename=\"".$f ilename."\"");

echo($new_rtf);

--END

Actually it's in a page with no HTML tags, I don't know if this is an
error or what...Can anybody help me?
What are you *expecting* to happen ??
Aug 30 '08 #8
Tim Streater ha scritto:
In article <48************ ***********@rea der4.news.tin.i t>,
Peter <zigozago@myhom ewrote:
>Hi all, I'm just trying to send a rtf file to the browser but firefox
and IE just display raw rtf content (with tags and so on)...
I used this code down below:

--CODE

$length = strlen($new_rtf );

$filename = "certificato_". $paz.".rtf";

header("Content-Type: application/rtf");

header("Content-Length: ".$length);

header("Content-Disposition:att achment; filename=\"".$f ilename."\"");

echo($new_rtf);

--END

Actually it's in a page with no HTML tags, I don't know if this is an
error or what...Can anybody help me?

What are you *expecting* to happen ??
Solved. It was a problem of an html opening tag just at the beginning
of the file
Aug 30 '08 #9

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

Similar topics

2
2547
by: LarsenMTL | last post by:
I have a long running python cgi which in the end returns a link to a pdf file. While it runs it generates a log that uses stdout right into the html. I use the sys.stdout.flush() to make this log output relatively realtime. The log, however, has grown too long. I wish to output it instead into a textarea. I thought I could just use the textarea tags before the output starts. This works, but my output is no longer "real time" even...
0
968
by: TJ Meadows via .NET 247 | last post by:
Ok this seemed like a simple task im programming in c# .NET the problem comes when i try to print a image back out of thedatabase to the browser. Here is my code: Response.ContentType = "image/jpeg"; DataSet DS = new DataSet(); // MSSQL Connection SqlConnection sqlConn = new SqlConnection("SERVER=" +ConfigurationSettings.AppSettings.ToString() +";UID=" +ConfigurationSettings.AppSettings.ToString() +";PWD="...
1
1345
by: dan | last post by:
I have written a class that scans a directory then builds a series of images (thumbnails) and returns an array of Image objects to the caller. When the call is made from a client aspx page it all looks fine but when I do a Response.BinaryWrite when in the loop which is itereating thru' the array of images, I only ever get one image output. Am I right in saying then that once I do a BinaryWrite call once any further data is ignored (ie....
13
2793
by: Jacek Dziedzic | last post by:
Hello! I have a piece of code that needs to display a formatted table of pointers using streams, with the pointers represented as hex values. It looks more or less like this: #include <iostream> #include <iomanip> using namespace std;
2
2777
by: Andy | last post by:
Hi I'm really stuck outputting a double number to the console with three decimal places if the furthest right value is a zero. I can coutput the number 4.546 as 4.546 but then if I output 0.220 it comes out as 0.22 and drops the zero. Also, outputting 1.000 outputs as 1. How can I format it to include the zeros?
2
1477
by: cephelo | last post by:
I have no problems outputting the attribute value when the node is in context, for example, @id when an <status> node is in context. However, I am having trouble outputting it in a <xsl:value-of /> element: <xsl:value-of select="procresults/settings@priority /> where it looks like
4
10518
by: Peter Nimmo | last post by:
Hi, I am writting a windows application that I want to be able to act as if it where a Console application in certain circumstances, such as error logging. Whilst I have nearly got it, it doesn't seem to write to the screen in the way I would expect. The output is:
5
1503
by: Steve | last post by:
I need to make an HTML page that has multiple choice quiz questions that pull from an XML doc. I have been looking at various online examples of how to do this, mainly this one: http://www.quirksmode.org/dom/importxml.html , but I can't get this damn thing working. Any help is appreciated, but if you write out the html/javascript code you'll be my hero. The example XML doc: <?xml version="1.0" ?> <quiz>
12
13430
by: billelev | last post by:
This is probably a very easy question to answer: I have been outputting some text to a message box, similar to the following: strOutput = "---" & Chr(10) & Chr(10) strOutput = strOutput & "VAR:" & AddTabs(1) & Format(rsVar!, "currency") strOutput = strOutput & Chr(10) & Chr(10) strOutput = strOutput & "Position Value:" & AddTabs(1) & Format(rsVar!, "currency") & Chr(10) strOutput = strOutput & "Position Risk:" & AddTabs(1) &...
0
9685
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10244
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
10201
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
10021
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
9061
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 project—planning, coding, testing, and deployment—without 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
7558
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
5454
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...
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.