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.
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
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)