473,395 Members | 1,762 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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:attachment; filename=\"".$filename."\"");

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 6958
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:attachment; filename=\"".$filename."\"");

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:attachment; filename=\"".$filename."\"");

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:attachment; filename=\"".$filename."\"");

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($filename);
5 header("Content-Type: application/rtf");
6 header("Content-Length: ".$length);
7 header("Content-Disposition:attachment; filename=\"".$filename."\"");
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:attachment; filename=\"".$filename."\"");

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*******@attglobal.net
==================

Aug 30 '08 #7
In article <48***********************@reader4.news.tin.it>,
Peter <zigozago@myhomewrote:
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:attachment; filename=\"".$filename."\"");

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***********************@reader4.news.tin.it>,
Peter <zigozago@myhomewrote:
>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:attachment; filename=\"".$filename."\"");

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
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...
0
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 =...
1
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...
13
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...
2
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...
2
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...
4
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...
5
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:...
12
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 &...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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,...

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.