Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

warning for :$fp = fopen("test.txt", 'w');

SeddighSeddigh Posts: 9Member
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.

Comments

  • ITAITA Posts: 463Member
    : 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!"

  • ApocistApocist Posts: 8Member
    : 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?


  • ITAITA Posts: 463Member
    : 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!"

  • MehanathenMehanathen Posts: 13Member


    : 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.
    :

  • ApocistApocist Posts: 8Member
    : : 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.
  • ITAITA Posts: 463Member
    : //
    : <?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!"

Sign In or Register to comment.