Which php functions are essential for adding content into file or uploading file?

Discussion in 'PHP' started by postcd, Oct 27, 2015.

  1. #1
    Hello,

    please without which php functions would be impossible to add content into file or upload an file from (computer or url) within an php script?

    i wish to find which functions are essential for doing that task:
    - adding new content to a file on apache, php webhosting
    - uploading new file (from computer or url or from whatever)
    - creating a file with content from within php script

    thank You
     
    postcd, Oct 27, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    PoPSiCLe, Oct 27, 2015 IP
    sarahk likes this.
  3. postcd

    postcd Well-Known Member

    Messages:
    1,043
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    190
    #3
    Previous reply did NOT solved issue.
    Im sorry im noob and not a programmer, im looking for the helpfull answer. Not an general advice not leading to answer to my question. Ofcourse im not willing to become programmer in order to discover answer to my question. Thanks! PS: please do not waste this thread space not answering to the question helpfully, im not only one who will read this topic in the future. be helpfull.
     
    postcd, Oct 28, 2015 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    I _was_ being helpful. That page list all the different PHP functions and methods to interface with the file system. Which was what you asked for, albeit that list is more exhaustive than your specific items.

    I can't help it if you're incompetent.

    As for your specific list-items?
    file_put_contents() will allow you to add to, or rewrite / create a file, with content.
    Uploading a file involves a BIT more then just a single function, as you want to check for correct filetype, size, etc, all depending on what you're trying to do.
    Uploading from your computer, or via an url are two different things entirely
     
    PoPSiCLe, Oct 28, 2015 IP
  5. postcd

    postcd Well-Known Member

    Messages:
    1,043
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    190
    #5
    this was much better, thanks

    so first function according to your oppinion is:
    file_put_contents()
     
    postcd, Oct 28, 2015 IP
  6. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #6
    It is one way to do it, yes. There are plenty others.
     
    PoPSiCLe, Oct 29, 2015 IP