My Guess is that the file is still open for reading, which means that you will need to initiate a file close. As you didn't provide the code for the class object you are opening I can only assume this to be the case. Which POI utility are you using, the one Ben put together, or are you rolling your own?
On Tue, Nov 29, 2011 at 1:13 PM, Mo Lay <[email protected]> wrote: > > >Can you post the upload and processing code you are using? > > > >---------------------- > >William Seiter > > > >On Nov 28, 2011, at 5:19 PM, Mo Lay <[email protected]> wrote: > > > >> > > > > here is it . The concerned part is within the catch expression. BAsically > soem users are converting 2007 xlsx files to xls but my function is unbale > to read it..so i need to stop that process and delete the loaded file. > > > > <cfif form.InputExcelFile neq ""> > > <!--- read operation ---> > <hr size="1"> > > > <!--- define temp excel ---> > <cfset strDir=GetDirectoryFromPath(ExpandPath("*.*")) & "/temp"> > > <cfset strInExcel=strDir> > > <!--- upload file ---> > <cffile action="Upload" filefield="InputExcelFile" > destination="#strInExcel#" nameconflict="MAKEUNIQUE"> > <cfset prodThumbDir=file.ServerDirectory> > <cfset prodThumbFile=file.ServerFile> > <cfset prodThumbExt=file.serverfileext> > > > <cfif (prodThumbExt neq "xls")> > Please check file extension. Only valid "xls" is accepted<br/><br/> > > > <cfelse> > > <!--- read excel ---> > > <cftry> > > <cfset strFilePath = "#prodThumbDir#/#prodThumbFile#"/> > <cfset arrSheets = objPOIUtility.ReadExcel(FilePath = > strFilePath,HasHeaderRow = true)/> > > <cfdump var="#arrSheets#"> > <cfloop index="intSheet" from="1" to="#ArrayLen( > arrSheets )#" step="1"> > > > > <cfset objSheet = arrSheets[ intSheet ] /> > <cfset qsheetMaxCol = objSheet.MAXCOLUMNCOUNT/> > <cfset qsheetName = objSheet.Name/> > > <cfif IsDefined ("qsheetName") AND #qsheetName# EQ > "CPR Summary"> > > do stuff.... > > </cfif> > > > > </cfloop> > > > <!---<cfoutput> <br/><br/> Template has been > submitted Successfully !</cfoutput>---> > > <cfcatch type="any"> > > > > <h3>There was a problem while reading > <cfoutput>"#prodThumbFile#" or "qsheetName" Object in not > defined</cfoutput></h3> > > <p align="left"> > Check the following : <br/> > File to process: > <b><cfoutput>#prodThumbFile#</cfoutput></b>. Please, make sure it is a > valid xls file<br/> > </p> > > <!--- HERE IAM EXPERIENCING THE ISSUE ---> > <!--- remove temp excel ---> > > <cfset > createObject("java","java.lang.Thread").sleep(JavaCast("int", 90000))> > <cffile action="DELETE" > file="#prodThumbDir#/#prodThumbFile#"> > > > > </cfcatch> > > </cftry> > > </cfif> > > <!--- remove temp excel ---> > <cftry> > > <cffile action="DELETE" file="#prodThumbDir#/#prodThumbFile#"> > <cfcatch type="Any"></cfcatch> > </cftry> > > <cfelse> > > </cfif> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5739 Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm
