나는 이것을 두시간 동안 붙들어 왔고 연구를 통해 해결책을 찾지 못했습니다.펄에서 파일을 업로드하기위한 헤더는 무엇입니까?
다음 HTML 코드는 내가 필요로 무엇을 작동합니다
<form action="uploader.php" method="POST" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="Filedata" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
그러나 다음 펄 코드가 작동하지 않습니다. 나는 이것이 필요한 헤더를 보내지 않기 때문이라고 생각합니다.
my @headers = ('Content-Disposition' => 'form-data; name="Filedata"; filename="test.txt"',
'Content-Type' => 'text/plain',
'Content' => 'File content goes here.');
my $browser = LWP::UserAgent->new;
my $response = $browser->post('uploader.php', undef, @headers);
아무도 내가 작동하지 않는 이유를 지적 할 수 있으면 감사 할 것입니다. 감사합니다.
'$ browser'는 무엇입니까? – Mat
죄송합니다. 다음을 추가하십시오. – user1807879
http://search.cpan.org/~gaas/HTTP-Message-6.06/lib/HTTP/Request/Common.pm의 양식 데이터로 POST의 예를 적용 해 보았습니다. ? – jpalecek