I wasn't making a change. I just introduced a class in that package so that I could access the CommonsFormFile class inside of CommonsMultipartRequestHandler. I called it: CommonsFileHelper. The reason I was using it was that the file was already uploaded, AND in the O/S, so I figured, why copy it again, especially if it's big - it just adds another step.
-----Original Message----- From: Dave Newton [mailto:newton.d...@yahoo.com] Sent: Wednesday, December 17, 2008 12:52 PM To: Struts Users Mailing List Subject: RE: get file path from FormFile It hardly seems necessary to make a framework change when you can just write the file. --- On Wed, 12/17/08, Givler, Eric <egiv...@state.pa.us> wrote: > From: Givler, Eric <egiv...@state.pa.us> > Subject: RE: get file path from FormFile > To: "'Struts Users Mailing List'" <user@struts.apache.org> > Date: Wednesday, December 17, 2008, 10:34 AM > Would there be an issue with modifying the controller settings and > setting the memFileSize artifically low so the file is always written > to disk, then gaining access to the filename via reflection? > > // create in package org.apache.struts.upload > public static String getFilePath( FormFile file ) { > String path = null; > Class > formClass=CommonsMultipartRequestHandler.CommonsFormFile.class; > Field fileItemField = formClass.getDeclaredField("fileItem"); > fileItemField.setAccessible(true); > Object o = fileItemField.get( file ); > if ( o instanceof DefaultFileItem ) { > DefaultFileItem df = (DefaultFileItem) o; > File osFile = df.getStoreLocation(); > path = osFile.getPath(); > } > return path; > } > > > -----Original Message----- > From: elyes sallem [mailto:elyes.sal...@gmail.com] > Sent: Tuesday, December 16, 2008 6:24 AM > To: Struts Users Mailing List > Subject: get file path from FormFile > > > Hello, > after publishing this question, i conclude that it is not possible de > get back the absolute path from FormFile but the problem is that i > import a jar file, in which i call a method that accept only path of > file so what do you propose, i get the inputstream , then i create > temporarly a file and i delete it at the end or you have an other > ideai? > > Thanks > Regards > Elyes. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: > user-h...@struts.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org