commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "redomancer redomancer" <redoman...@gmail.com>
Subject IE7 and Apache Common File Upload
Date Wed, 18 Jul 2007 16:29:36 GMT
Hello!
I am not sure i am posting the questions in right place, but i have no other
option.

I have problem witch is related to Apache Common File Upload.

First of all - the code I am using for file saving:

/********************************/
                FileItemIterator anIterator = (new
ServletFileUpload()).getItemIterator(aRequest);
                FileItemStream anItem = null;
                InputStream aInputStream = null;
                while (anIterator.hasNext()) {
                    anItem = anIterator.next();
                    aInputStream = anItem.openStream();
                    if (anItem.isFormField())
                        // ... form field
                    else {
                        BufferedInputStream aBufferedInputStream = new
BufferedInputStream(aInputStream);
                        OutputStream aOutputStream = new
FileOutputStream(getRealPath() + anItem.getName());
                        BufferedOutputStream aBufferedOutputStream = new
BufferedOutputStream(aOutputStream);
                        int aStreamedDataSize = 0;
                        while((aStreamedDataSize =
aBufferedInputStream.read())!=-1)
{
                            aBufferedOutputStream.write(aStreamedDataSize);
                        }
                        aBufferedOutputStream.flush();
                        aBufferedOutputStream.close();
                        aBufferedInputStream.close();
                        aOutputStream.flush();
                        aOutputStream.close();
                    }
                }
/********************************/

getRealPath() is my function what returns the directory where file must be
saved.

And now the problem: anItem.getName() for IE7 returns FULL path to file on
client side machine.
For example: if i had file C:\upload_me.txt, then anItem.getName() will
contain "C:\upload_me.txt" if IE7 submits data;
for other browsers anItem.getName() will contail value "upload_me.txt".

Is it supposed to be so?
What data anItem.getName() must return? And what is the correct way to get
file name for all browsers then?

P.S.
Sorry, if my question is silly.


redo

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message