Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2002
    Thanked 0 Times in 0 Posts

    on-site text/file editing.

    When it comes to php i'm a real lightweight, and the only experience i've had with it up till now was with mysql. I'm helping my friend out with his site but it doent have a mysql database.

    SO i made these include files for him that mostly have detailed instructions on how to modify an array to update his site... he still doesnt get it... and ftp kinda scares him.

    So, to get to the point, (finally,) i'm making a webpage where he can just upload his (for example) image files, and i was wondering what a good way to have these automatically entered into the array of photos to display. (that array i mentioned, sitting by itself in an include file)

    that probly seem extremely simple... also i need to know how i can load a text based file into a text area input field, that, when submitted will replace the old file with the updated/submitted one

    you could probly just call toss me a couple of funtion names... i know where php.net is but if you want to be my hero, you slap some stuff together :-P

    seldom ruined but by myself

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Montreal, Canada
    Thanked 0 Times in 0 Posts
    edit file:

    PHP Code:


    $txt $_POST['txt'];

    if (
    $txt) {
    $fpw fopen ($filename"w");
      if (!
    fwrite($fpwurldecode($txt))) {
    "Unable to write to file";

    if (
    file_exists($filename)) {
    $fpr fopen ($filename"r");
    $content fread ($fprfilesize ($filename));


    <form method="POST">
      <textarea rows="15" cols="80" name="txt"><?=$content?></textarea>
      <input type="submit" value="Update File">
    Last edited by x_goose_x; 03-13-2003 at 11:15 PM.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts