Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fcgi_stdio.h>
- #include <stdlib.h>
- int main(void)
- {
- int len = 0;
- while(FCGI_Accept() >= 0) {
- FILE * fp = fopen("/wwwdata/example.txt", "w+");
- char *content_type = getenv("CONTENT_TYPE");
- char *contentLength = getenv("CONTENT_LENGTH");
- if (contentLength != NULL)
- len = atoi(contentLength);
- else
- len = 0;
- printf("Content-type: text/html\r\n"
- "\r\n"
- "<!DOCTYPE html><html><head><meta content='text/html;charset=utf-8' http-equiv='Content-Type'><meta charset='utf-8' http-equiv='encoding'><script type='text/javascript'>"
- "function f(){var x = new XMLHttpRequest();x.open('POST', '/i/a.out', true);x.timeout = 300000;"
- "var f = new FormData();"
- "f.append('f', window.document.getElementById('f').files[0]);"
- "x.send(f);"
- "}</script></head><body>"
- "<b>%d</b><input type='file' id='f' name='f' accept='image/png'><p onClick='f();'>PRESS!</p></body></html>\n"
- ,len);
- if (len > 0 && content_type != NULL)
- for(int i = 0; i < len; i++)
- putc(content_type[i], fp);
- fclose(fp);
- FCGI_Finish();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement