AW: [Webtest] Extension Field Usability: setFileField
Marc Guillemot
webtest@lists.canoo.com
Tue, 12 Jul 2005 17:25:40 +0200
Hi,
> i'm using the setFileField step and it seems to be working - almost.
> I receive the filename ok, but the file is EMPTY.
>
> e.g.
> enter: fileName="import.csv" (size=2KB)
> receive: fileName="import.csv" (size=0)
not really what it should do ;-(
>
> On the page receiving the file i read in the parameters with:
> import com.oreilly.servlet.multipart.MultipartParser;
>
> MultipartParser multPart = new MultipartParser(request, 1024 * 1024 * 8, true, true);
> while ((part = multPart.readNextPart()) != null) {
> if (part.isFile()) {
> FilePart filePart = (FilePart) part;
> String filename = filePart.getFileName().toLowerCase();
> if (filename.endsWith("csv") || filename.endsWith("xml")) {
> ByteArrayOutputStream baos_out =
> new ByteArrayOutputStream(8 * 1024 * 100);
> fileSize = filePart.writeTo(baos_out);
> String fileID = filePart.getName().toLowerCase();
> }
> }
> }
>
>
>
> By the way:
> How can i change the log-level to debug?
> I have a log4j.properties in my classpath and modified the line:
>
> log4j.rootCategory=debug, stdout
>
> but it doesn't work.
if it is really on the classpath, I guess that you have an other logj config file on your classpath that is taken in
place of the one you've edited.
Marc.