turbine-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C Mason@ Intechtual" <cma...@intechtual.com>
Subject RE: FileItem - write method error....
Date Wed, 17 Oct 2001 15:37:51 GMT
I had encountered the same problem with .gif files.  It only occurs in "in
memory" files.  I traced the problem back to the string encoding corrupting
the binary data.
Here's my fix:


    public void write(String file) throws Exception
    {
        if (inMemory())
        {
            //FileWriter writer = new FileWriter(file);
            FileOutputStream writer = new FileOutputStream( file );
            //writer.write(getString());
            writer.write( this.get () );
            writer.close();
        }
        else if (storeLocation != null)
        {
            /*
             * The uploaded file is being stored on disk
             * in a temporary location so move it to the
             * desired file.
             */
            if (storeLocation.renameTo(new File(file)) == false)
            {
                throw new Exception(
                    "Cannot write uploaded file to disk!");
            }
        }
        else
        {
            /*
             * For whatever reason we cannot write the
             * file to disk.
             */
            throw new Exception("Cannot write uploaded file to disk!");
        }
    }


Hope this helps,

Chris Mason
cmason@intechtual.com

-----Original Message-----
From: Ling Kok Choon [mailto:kokchoon78@yahoo.com]
Sent: Wednesday, October 17, 2001 6:44 AM
To: turbine-user@jakarta.apache.org
Subject: FileItem - write method error....


Hi,

   I use turbine upload service to upload file to
server, but i face some error when upload files by
using write method. The error is not consistent, some
files like flash, and picture file will corrupt when
upload to server.

the upload service setting at the
TurbineResuouces.properties is :

services.UploadService.automatic=true

#
# The directory where files will be temporarily
stored.
#
services.UploadService.repository=.

#
# The maximum size of a request that will be
processed.
# 2.5 mb
#
services.UploadService.size.max=2621440
#
# The maximum size of a request that will have it's
elements cached in
# memory by TurbineUploadService class.
#
services.UploadService.size.threshold=10240

Is the setting above valid ?

and the system available physical memory is only
68343K, is it the cause of this error , or others ?


Thank you.

regards,
kok choon


__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Mime
View raw message