Retrieve file upload data
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
char *content_length = 0;
int len = 0;
printf("Content-type:text/html\n\n");
printf("<html><body>");
content_length = getenv("CONTENT_LENGTH");
len = atoi(content_length);
char input[len+1];
fgets(input,len,stdin);
puts(input);
printf("</body></html>");
return 0;
}
I have the cgi code above. Whenever I click the submit button on my html
form, it only outputs "------WebKitFormBoundaryIgcEYm5FWH1GVhkn" . It
doesn't output the contents of the file uploaded. Really need help here.
Stuck on this. Thanks!
No comments:
Post a Comment