2013-08-11 5 views
1
#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; 
} 

위의 cgi 코드가 있습니다. 내 HTML 양식에서 제출 버튼을 클릭 할 때마다 "------ WebKitFormBoundaryIgcEYm5FWH1GVhkn"만 출력됩니다. 업로드 된 파일의 내용을 출력하지 않습니다. 정말 도움이 필요합니다. 이걸 붙잡아 라. 감사!파일 업로드 데이터 가져 오기

답변

1

fgets에 의해 fread으로 바꾸어서 문제를 해결했습니다.

관련 문제