473,442 Members | 4,772 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Why its not working in browser?

Hello...
Below i have listed a some codes. It is working well in putty but not in browser(IE, google chrome).

Will u help me?
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $fp = @fopen("sample.txt",'w') or die("Could not open sample.txt file");
  3.  
  4. fwrite($fp,"Testing\n");
  5. fclose($fp);
  6. ?>
  7.  
  8. <HTML>
  9.  
  10. File open testing
  11. </HTML>
  12.  
  13.  
Apr 18 '11 #1
6 1672
What exactly is not working? =) Are you receiving some kind of error or is your file just not being written?
Apr 18 '11 #2
Im getting "Could not open sample.txt file" which i have written in the program.
Apr 18 '11 #3
Hm, that's odd, because over here your code is working. Have you checked if you are allowed to create new files in the directory you are trying to create 'sample.txt'?
Apr 18 '11 #4
Oh.... Did u run php program by browser?

If so, wat browser u have used?

How i need to allow for creating new files in my directory?
Apr 18 '11 #5
Yes, I ran it in my browser, which is Firefox 4.0.

You need to chmod your directory if you're working on a hosted FTP server, which you can do by right clicking the folder in your FTP client program and then clicking something like 'chmod' or 'edit permissons' (the term used for editing those permissions is chmodding). You need to make sure that the server is allowed to create new files there.

If you're using a local server, I have no idea how to do that :). Perhaps you can Google it?

This is the code I used:

Expand|Select|Wrap|Line Numbers
  1. $file = fopen('writeable.txt', 'w');
  2. fwrite($file, 'hoi');
  3. fclose($file);
  4.  
  5. $file = fopen('writeable.txt', 'r');
  6. $content = fread($file, filesize('writeable.txt'));
  7. echo $content;
Apr 18 '11 #6
I changed the directory permission. Now its working well....
Thanks for ur help......... :)
Apr 19 '11 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Josip Habjan | last post by:
Hi, I have VS 2003 installed. In VS 2002 all worked fine, but... when I reinstall my PC and put VS 2003, ASP.NET dont work propertly.. All other controls are fine, only DataGrid dont exist......
0
by: Sai Kiran | last post by:
Hi Curt, Regarding my previous question, i am not developing a website. i am developing a product for our internal company purpose which is located at different places. So, i developed a web...
15
by: CMM | last post by:
So I'm half way through overseeing a large project in ASP.NET 2.0. My superiors have decided that it would be nice if we ensured the site worked on all the major platforms (as they see it: IE,...
9
by: balakrishnan.dinesh | last post by:
hi friends, Exactly what i want to know is, In my product we are using xmlhttp request to retrive some data from the server, And Im using IE browser, its working fine in IE. Now i want to work...
4
by: igotyourdotnet | last post by:
I have a web app that I want to make the pages render correctly based on what type of browser is connected. How can I determine if the browser is the desktop IE version or a handheld device version?
0
by: etnaelk | last post by:
Hi all, I have a real bugger of a problem that I just haven't been able to figure out. I am working on writing my own proxy server in C# using TcpListener, TcpClient, HttpWebRequest/Response and...
11
by: Anshul | last post by:
How can I check the current working browser from server side scripting or from HTML other than javascript. Can any body help. I dont want to use javascript to check the current working browser. ...
3
by: Danigan | last post by:
I could about swear this was working perfectly while I was adding some other functionality somewhere else. I now removed that functionality and it doesn't work. If someone could find what I broke,...
246
by: Chris F.A. Johnson | last post by:
I have posted a quick survey at <http://cfaj.freeshell.org/testing/width.shtml>. There's only one question: select the widest line that fits in your normal browser window. Your assistance is...
3
by: Rekha Kumaran | last post by:
Hello Friends... Im creating a Webpage. I pick values from Mysql and showed it in the HTML table. I want to create a SAVE button for storing the values which are shown in the HTML table. ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
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...
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...

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.