priyadharshini Posted March 16, 2011 Share Posted March 16, 2011 Hi all, I have a problem in displaying my file content in browser. It is being displayed with lots of junk values. I dont know how to clear that.Please someone help! The used the coding as follows: public function readContent($sEdit, &$contents = null){ if (file_exists($sEdit)) { $handle = fopen($sEdit, "r"); if ($handle) { while (!feof($handle)) { $contents .= fgets($handle, 4096); } fclose($handle); } } } Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/230790-getting-junk-values/ Share on other sites More sharing options...
Adam Posted March 16, 2011 Share Posted March 16, 2011 Can you be more specific than "junk values"? Quote Link to comment https://forums.phpfreaks.com/topic/230790-getting-junk-values/#findComment-1188125 Share on other sites More sharing options...
AbraCadaver Posted March 16, 2011 Share Posted March 16, 2011 Can you be more specific than "junk values"? Yes, and why not just file_get_contents()? Quote Link to comment https://forums.phpfreaks.com/topic/230790-getting-junk-values/#findComment-1188287 Share on other sites More sharing options...
cunoodle2 Posted March 16, 2011 Share Posted March 16, 2011 I'm going to bet that he is referring to the "\n" and the "\t" Is this correct? Quote Link to comment https://forums.phpfreaks.com/topic/230790-getting-junk-values/#findComment-1188334 Share on other sites More sharing options...
priyadharshini Posted March 25, 2011 Author Share Posted March 25, 2011 Am getting junk values like this before and also after the contents ÐÏࡱá����������������>�þÿ ���������������[����������]������þÿÿÿ����Z���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ Quote Link to comment https://forums.phpfreaks.com/topic/230790-getting-junk-values/#findComment-1192075 Share on other sites More sharing options...
silkfire Posted March 25, 2011 Share Posted March 25, 2011 It could be a binary file. Try open it in Notepad see what you get. Quote Link to comment https://forums.phpfreaks.com/topic/230790-getting-junk-values/#findComment-1192088 Share on other sites More sharing options...
priyadharshini Posted March 25, 2011 Author Share Posted March 25, 2011 I just want to open the file in my browser. It is an uploaded word .doc file but when displayed in browser i got like this Quote Link to comment https://forums.phpfreaks.com/topic/230790-getting-junk-values/#findComment-1192090 Share on other sites More sharing options...
silkfire Posted March 25, 2011 Share Posted March 25, 2011 Man you can't open a Word file in a browser it's not a text file... Google Docs has some way of doing it but you would require some library of sorts. Quote Link to comment https://forums.phpfreaks.com/topic/230790-getting-junk-values/#findComment-1192092 Share on other sites More sharing options...
priyadharshini Posted March 25, 2011 Author Share Posted March 25, 2011 can u suggest me some script for word to text conversion Quote Link to comment https://forums.phpfreaks.com/topic/230790-getting-junk-values/#findComment-1192097 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.