I have found some magic numbers for the file size that are the threshold from being correct to being wrong.
1. with FF browser, any files that are no bigger than 7912 bytes can be properly uploaded.
2. with Chome, any files that are no bigger than 7920 bytes can be properly uploaded.
Anything longer than that the the uploaded files are almost 2X as large on the server.
The number varies slightly by a few bytes on another machine.
Again, the html for the test:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="@{Application.upload()}" method="POST" enctype="multipart/form-data">
<input type="text" name="title" />
<input type="file" id="photo" name="f" />
<input type="submit" value="Send it..." />
</form>
Not yet working with the current nightly build.
My test file is a bunch of files with random characters in, generated by:
$ dd if=/dev/urandom of=afile.txt bs=1 count={file size}
I have found some magic numbers for the file size that are the threshold from being correct to being wrong.
1. with FF browser, any files that are no bigger than 7912 bytes can be properly uploaded.
2. with Chome, any files that are no bigger than 7920 bytes can be properly uploaded.
Anything longer than that the the uploaded files are almost 2X as large on the server.
The number varies slightly by a few bytes on another machine.
Again, the html for the test:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http:// www.w3. org/TR/ html4/frameset. dtd"> "Content- Type" content="text/html; charset=UTF-8"> "@{Application. upload( )}" method="POST" enctype= "multipart/ form-data" >
<html>
<head>
<meta http-equiv=
<title>Insert title here</title>
</head>
<body>
<form action=
<input type="text" name="title" />
<input type="file" id="photo" name="f" />
<input type="submit" value="Send it..." />
</form>
</body>
</html>
The controller code snippet:
public static void upload(File f, String title){ out.println( "title: " + title); out.println( f.length( )); .getInstance( ).saveFile( f.getName( ), f); ("ok");
System.
System.
UploadUtil
renderText
}
Again, both machines are windows, JDK6, Chinese locale.