Yet another PHP question....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • FADE19
    Snow's Parole Officer
    • Sep 2001
    • 1161

    #1

    Yet another PHP question....

    Ok,
    I have figured out how to
    1)Write to a file
    2)Read a file
    3)Copy a file
    4)Delete a file

    but how the hell do you create a file??? programmatically?? I know I can go in there and add a file yes...but how do you create one via code? thanks in advance...
  • Ted
    Confirmed User
    • Nov 2001
    • 830

    #2
    touch ("myfile.txt");

    you can include a path with the file name if need be

    Comment

    • FADE19
      Snow's Parole Officer
      • Sep 2001
      • 1161

      #3
      Thanks Ted, I have 5 different PHP books here and not one of them explains shit about how to create a file...time to update my book selection...

      Comment

      • Matt
        Confirmed User
        • Aug 2001
        • 173

        #4
        http://www.php.net/manual/en/ref.filesystem.php

        Comment

        • aleck
          Confirmed User
          • Jan 2001
          • 940

          #5
          actually if u r opening a file for writing it can be created automatically (depending on the mode tho)

          mode may be any of the following:


          'r' - Open for reading only; place the file pointer at the beginning of the file.

          'r+' - Open for reading and writing; place the file pointer at the beginning of the file.

          'w' - Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.

          'w+' - Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.

          'a' - Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.

          'a+' - Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.



          ------------------

          PlatinumBucks - amazing conversions, 65% recurring or $30+ per signup
          BigPenis - $30 per signup from lifetime membership
          come trade shemale traffic here

          Comment

          • amadman
            Confirmed User
            • Nov 2001
            • 738

            #6
            I am not sure about php but some languages create a file when you open it for writing or apending and it does not already exist.
            Affordable Quality Niche Content at <a href="http://reyko.com/in.php?ref=amadman">Reyko</a>

            Please submit your free and AVS sites <a href="http://xstash.com/sexpack/submit.html">here</a>

            Comment

            • amadman
              Confirmed User
              • Nov 2001
              • 738

              #7
              aleck
              Beat me to the post :o)
              Affordable Quality Niche Content at <a href="http://reyko.com/in.php?ref=amadman">Reyko</a>

              Please submit your free and AVS sites <a href="http://xstash.com/sexpack/submit.html">here</a>

              Comment

              • FADE19
                Snow's Parole Officer
                • Sep 2001
                • 1161

                #8
                I know that when you are using FSO in ASP you actually have to create the file first...it is nice switch not have to do that

                Comment

                Working...