Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    20
    Thanks
    3
    Thanked 0 Times in 0 Posts

    How can i download (open) .txt file? using php

    how can i open (download) .txt file , i.e located in my local system by using php coding.when i click some link,it automatically open the .txt file(located on C:/folder/test.txt). please anybody help me.how can i do that.

  • #2
    New Coder
    Join Date
    Aug 2007
    Location
    Wagga, Australia
    Posts
    59
    Thanks
    0
    Thanked 1 Time in 1 Post
    Well if you didn't want to save the changes to the file, which i'm guessing you are, you could provide a link that will open the text file in the browser.

    But if you want to edit it you would need to open the file, read each line and save it to a variable. Then put that variable in a
    Code:
    <textarea>
    tag with a submit button that saves the changes to the txt file.

    go here to learn how to do it http://php.net/manual/en/function.fopen.php


  •  

    Posting Permissions

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