-
-
Save oetiker/21107f3b2ceaa6790ecf to your computer and use it in GitHub Desktop.
content length test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head><title>Upload Status</title></head> | |
<body> | |
<h1>Upload Analysis</h1> | |
Content-Length: 200<br/> | |
Body Length: 198 | |
<pre>------WebKitFormBoundaryws59zNAFCL2uMvIt | |
Content-Type: application/octet-stream | |
Content-Disposition: form-data; name="example"; filename="one-byte" | |
------WebKitFormBoundaryws59zNAFCL2uMvIt--</pre> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Mojolicious::Lite; | |
get '/' => 'form'; | |
post '/upload' => 'status'; | |
app->start; | |
__DATA__ | |
@@ status.html.ep | |
<!DOCTYPE html> | |
<html> | |
<head><title>Upload Status</title></head> | |
<body> | |
<h1>Upload Analysis</h1> | |
Content-Length: <%= $self->req->headers->content_length %><br/> | |
Body Length: <%= length($self->req->build_body) %> | |
<pre><%= $self->req->build_body %></pre> | |
</body> | |
</html> | |
@@ form.html.ep | |
<!DOCTYPE html> | |
<html> | |
<head><title>Upload</title></head> | |
<body> | |
%= form_for upload => (enctype => 'multipart/form-data') => (method => 'POST') => begin | |
%= file_field 'example' | |
%= submit_button 'Upload' | |
% end | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment