PHP

Moderators: None (Apply to moderate this forum)
Number of threads: 1847
Number of posts: 5013

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
warning for :$fp = fopen("test.txt", 'w'); Posted by Seddigh on 1 Oct 2005 at 1:24 AM
hi
i php beginer and practic in localhost windows by IIS.
this code for opening file for writing have warning and cannot open.
is_writable($filename) is true too.
please help me.
thanks, bye.
Report
Re: warning for :$fp = fopen("test.txt", 'w'); Posted by ITA on 1 Oct 2005 at 2:09 AM
: hi
: i php beginer and practic in localhost windows by IIS.
: this code for opening file for writing have warning and cannot open.
: is_writable($filename) is true too.
: please help me.
: thanks, bye.
:

Please could you give some code examples and the exact error/warning message that you are getting. That way, we will be able to help you better - it is difficult to know exactly what to do, when there are only a few hints provided.

Thank you.

ITA
"Let us smite the evil slime eating hordes who may befall us on our quest to be the ultimate programmers of the known universe!"

Report
Re: warning for :$fp = fopen("test.txt", 'w'); Posted by Apocist on 27 Feb 2006 at 10:19 PM
: Please could you give some code examples and the exact error/warning message that you are getting. That way, we will be able to help you better - it is difficult to know exactly what to do, when there are only a few hints provided.
:
: Thank you.
:
: ITA
: "Let us smite the evil slime eating hordes who may befall us on our quest to be the ultimate programmers of the known universe!"
:
:
(Due to the fact that I was unable to find a post to solve my problem and that this one seems to deal with what I'm working on, yet is remained un anwsered)

I am also new to php and am curious on how to open a file on the local (user's) computer. Instead I'm using the command file_get_contents.
so far I have been able to make my script open a sample txt file on my server but I don't understand what to input to recieve from a computer. This is my script so far:
//
<?php
$myfile = substr(file_get_contents('Config.ini'),141,10);
echo $myfile
?>
//
The contents of test.txt:
//
[ScreenMode]
ScreenModeRecord=0
[Group]
GroupRecord=4
[Server]
ServerRecord=3
[Interface]
InterfaceRecord=0
[Account]
AccountRecord=Apocist
//
The script to ment to view the name of the user account name.
Now lets say if I wanted to view default name of the user in "C:/Program Files/Sample App/Config.ini" How would I do that?


Report
Re: warning for :$fp = fopen("test.txt", 'w'); Posted by ITA on 28 Feb 2006 at 2:39 AM
: The script to ment to view the name of the user account name.
: Now lets say if I wanted to view default name of the user in "C:/Program Files/Sample App/Config.ini" How would I do that?

You can't do it (to my knowledge) because PHP is a server side language, so you can't access things on the user's machine. If you want to that sort of thing, then you'll have to use JavaScript or similar.

Regards,

ITA



"Let us smite the evil slime eating hordes who may befall us on our quest to be the ultimate programmers of the known universe!"

Report
Re: warning for :$fp = fopen("test.txt", 'w'); Posted by Apocist on 28 Feb 2006 at 8:56 AM
: : The script to ment to view the name of the user account name.
: : Now lets say if I wanted to view default name of the user in "C:/Program Files/Sample App/Config.ini" How would I do that?
:
: You can't do it (to my knowledge) because PHP is a server side language, so you can't access things on the user's machine. If you want to that sort of thing, then you'll have to use JavaScript or similar.

I thought that it was possible because the example of another function I found at php.net:

//
<?php
$handle = fopen("c:\\data\\info.txt", "r");
?>
//

which appears to open a local file.
Report
Re: warning for :$fp = fopen("test.txt", 'w'); Posted by ITA on 28 Feb 2006 at 10:43 AM
: //
: <?php
: $handle = fopen("c:\\data\\info.txt", "r");
: ?>
: //
:
: which appears to open a local file.
:
That opens the info.txt file on the server (assuming you have a Windows server), not on the client machine.

Regards,

ITA
"Let us smite the evil slime eating hordes who may befall us on our quest to be the ultimate programmers of the known universe!"

Report
Re: warning for :$fp = fopen("test.txt", 'w'); Posted by Mehanathen on 28 Feb 2006 at 5:03 AM


: hi
: i php beginer and practic in localhost windows by IIS.
: this code for opening file for writing have warning and cannot open.
: is_writable($filename) is true too.
: please help me.
: thanks, bye.
:




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.