Code: Select all
<form action="execute.php" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" /><br />
<input type="submit" name="submit" value="Submit"" />
</form>
Code: Select all
$ob_file = fopen("../../log.txt",'w') or die ("cannot create log.txt");
function ob_file_callback($buffer)
{
global $ob_file;
fwrite($ob_file,$buffer);
}
ob_start('ob_file_callback');
system ("../../sourceShell") or die ("sourceShell fail") ;
ob_end_flush();
When a visitor clicks 'submit' (or upon the completion of uploading), I need execute.php to echo "Your job is running..please wait". And then I want to refresh the page every 5 mins until the job finishes and the result will be shown. My problem is that, when a visitor clicks 'submit', it waits until the fortran program completely finishes (which takes a long time) before it outputs the "Your job is running..please wait". I suspect this is because of the ob_file_callback function. If I don't use that function, it seems like the log prints in real time to my browser as the program runs.
I do hope this make sense... and I've spent days on this wanting to tear off my hair, so it's not like I haven't googled hard. I'm completely new to web programming, so I hope you guys understand. Thank you in advance.