dcsimg
www.webdeveloper.com
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
    Posts
    1

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

    Hi,

    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
    Location
    Ankh-Morpork
    Posts
    19,614
    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().
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

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



Recent Articles