Results 1 to 2 of 2

Thread: Created File does not show up in folder after call to function

  1. #1
    Join Date
    Nov 2012

    Created File does not show up in folder after call to function


    I'm creating a file using file_put_contents that gets updated with a progress status through a loop in the PHP. This created file is for a file upload program and allows me to access the created file with AJAX to update the progress status to the client.

    There is a problem, however, with the file not being created after a call to the file_put_contents function is complete. Instead, the file is created after the entire PHP processing the file upload is completed, which by that time is too late to inform the client of their upload progress because the file is already uploaded.

    I can't figure out what could be causing the problem and hope you can help.

  2. #2
    Join Date
    Aug 2004
    Hard to say without seeing any of the code, but file_put_contents() is a one-shot operation. If you want to incrementally add data to a file (such as in a loop), you may want to use fopen(), fwrite() (within the loop?), and fclose().
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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