Welcome! Log In Create A New Profile


error viewing text files

Posted by FinalOracle 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
error viewing text files
November 07, 2012 04:03PM

has anyone come across a free hosting site that does not display text files?

i have at 000webhost.com and they said is for security reasons.

i used the followed steps:

Uploaded register_code.txt as normal.
Added the following lines to .htaccess

RewriteEngine on
RewriteRule register_code\.txt$ /register_code.php [L]

and used :

header ("Content-Type: text/plain"winking smiley;
include "register_code.txt";

for the register_code.php file

then i finally managed to view the files, but i only see about 40% of the contents of the texts files i uploaded

any advice
Re: error viewing text files
November 07, 2012 04:48PM
Ahem.... use the formatted code button to post code......!

Tricky. One option, I think, is to have link to a html file, and then import the .txt file into an iframe. It may work, for the reason that the server scans for files ending with a .txt extension before rendering the page. Importing it into an iframe is not the same as rendering a page. Long shot.

Else just use an html file printing the code.
Re: error viewing text files
November 08, 2012 09:17AM

it worked nicely

Re: error viewing text files
November 08, 2012 09:38AM

when i reload the page it only displays the html code in the text files and does't display the php source code texts, then it added this text at the bottom of the page:

<!-- Hosting24 Analytics Code -->
<script type="text/javascript" src="http://stats.hosting24.com/count.php"></script>;
<!-- End Of Analytics Code -->

any clarification will be appreciated
avatar Re: error viewing text files
November 08, 2012 10:14AM
I found the easiest process was to use was to create a javascript function, such as the one detailed below, and then launch this with an onclick event in the button.

Language: Javascript
<script type="text/javascript"> function openNewWindow() { newWindow=window.open("../project/library/insert.txt","","width=350,height=500"); newWindow.focus(); } </script>
Re: error viewing text files
November 08, 2012 12:39PM

i followed your suggestion, but i get the same results as before, this is what i tried:
Language: PHP
<script type="text/javascript"> function ViewTextFile() { newWindow=window.open("register_code.txt","","width=350,height=500"); newWindow.focus(); } </script>   and used the button with an onclick event "onclick=';ViewTextFile()';
Re: error viewing text files
November 09, 2012 07:36AM
I suggested an <iframe>.... but no guarantees.
Sorry, only registered users may post in this forum.

Click here to login