September 30th, 2013, 05:41 AM
Join Date: Jul 2013
Time spent in forums: 6 h 55 m 39 sec
Reputation Power: 0
Update progress bar with CGI in C
Trying to upload file with cgi in C and show file uploading with progress bar. Uploading file with cgi works fine, but have problem with refreshing progress bar control.
This is client html code:
<!DOCTYPE html> |
<html> <head> </head>
<form ENCTYPE="multipart/form-data" method="POST" action="http://localhost/homecgi/progress.exe">
Name: <input type="text" name="first_name" value="John" /> <br />
<INPUT NAME="fileupload" TYPE="file" multiple/> <BR>
<input type="submit" name="action" value="Submit" />
In cgi script trying to upload file and with every byte read refresh progress bar value:
| ... |
int i = 0, n, zb;
printf(" <progress id='progressBar1' value='0'></progress> <br>");
printf(" document.getElementById('progressBar1').max = %d; ", content_length);
n = fread(s_content, 1, 1, stdin);
zb += n;
printf(" document.getElementById('progressBar1').value = %d; ", zb);
Server sends new progress bar value to client, but when there is to much bytes of uploading file, more then 10kB, client cant render progress bar, and get stuck with: CGI Timeout The specified CGI application exceeded the allowed time for processing. The server has deleted the process.
Any suggestions! Maybe some other way to deal with this stuff?