1

This issue continues along with the inability to run the remaining parts of the process in the application, namely the file sorting by file type and the compression capability. I'm running into the issue that my pdf compression code is causing the multifile uploader to freeze up at 99%, still successfully uploading the first file but preventing subsequent files from uploading.

Issue 1: File upload fails when I try to exclude the pdf files from the list.

Issue 2: The presence of the query and loop code to compress the pdf files causes the fileuploader to stop at 99%, still uploading the first file but no subsequent files in the multi-file upload.

Multifile upload handler code

 <cfif Files eq 'Multiple'>
<cffile action="upload" destination= "c:\uploads\" result="myfiles" 
nameconflict="makeunique" >

<cfset fileSys = CreateObject('component','cfc.FileManagement')>

<cfif Len(get.realec_transactionid)>
    <cfset internalOnly=1 >
</cfif>     

    <cfset uploadedfilenames='#myfiles.clientFile#' >



   <!---This variable contains the list of files from the multifile upload module--->    
    <cfset uploadedfilenames='#myfiles.clientFile#' >




<!---Exclude PDF file types from the file list to relocate to the NAS--->
                   <cfset lResultList = ""/>
            <cfset fileExtToExclude = "pdf" />
            <cfloop list="#uploadedfilenames#" index="fileItem" delimiters=",">
            <cfif ListLast(ListLast(fileItem, '\'), '.pdf') NEQ  
            fileExtToExclude>
            <cfset lResultsList = ListAppend(lResultList, fileItem) />
            </cfif>
            </cfloop>
**This is where the upload failure begins: when the original variable is set as the result of the above code**

        <cfset uploadedfilenames = lResultList />
        This subsequent code does not execute

    <cfquery name="addFile" datasource="#request.dsn#">
            INSERT INTO upload_many (title_id, fileDate, filetime, fileupload)
                    VALUES('#get.title_id#', '#dateTimeStamp#', '#a_insert_time#', '#new_file_name#')
        </cfquery>  

    <cfelse>    
        <cffile action="upload" destination= #ExpandPath("./uploaded_files/zip.txt")# nameconflict="overwrite" >
    </cfif>
    <!---This block then pulls a file list from the DB table of files just uploaded and then loops through the names executing the pdf compression app on the files--->
    cffunction access="remote" name="compressFiles" returntype="void" output="no">
        <!---Get File List and Loop Through Compression--->
        <cfquery name="qryGetFilesJustUploaded" datasource="#request.dsn#">                                            
     <!--- Limit to filed with pdf file type endings --->
        SELECT fileupload
        FROM [First_Title_Services_Dev].[dbo].[upload_many]
        WHERE filedate >= '#dateTimeStamp#' AND fileupload Like '% .pdf'
        </cfquery>

        <cfloop query="qryGetFilesJustUploaded">
        <cfset pdf_file_name = 'qryGetFilesJustUploaded.fileupload' />
        <cfexecute name="C:\Program Files (x86)\neeviaPDF.com\PDFcompress\cmdLine\CLcompr.exe"
        arguments="C:\uploads\#pdf_file_name# C:\uploads\#pdf_file_name# -co -ci jpg -cq 10 -gi jpg -gq 10 -mi jbig2 -mq 1"
        outputfile="C:\uploads\output.txt"  
        timeout="250">
        </cfexecute>
        </cfloop>
        </cffunction>
Alex
  • 443
  • 3
  • 18
  • Do you have any sample code? – James A Mohler Jun 18 '15 at 20:29
  • What goes into ColdFusion logs? – Anit Kumar Jun 18 '15 at 20:35
  • Nothing is getting logged in the CF logs when the flash file upload module is used. It only generates a vague status 500 error. This is a very odd CF setup as there are many things that don't get logged, but I'm not the one who set it up. Just trying to work with what I was handed. – Alex Jun 18 '15 at 20:45
  • You have ``. Firstly you don't need the `# #` around the variable here. But more importantly, you have lResultList and lResultsList - is this deliberate? In your code later that errors you refer to just lResultList not lResultsList – duncan Jun 18 '15 at 21:01
  • You do something similar later in the erroring code, your query is called `qryGetFilesJustUploaded` but you try and loop over a query called `qryGetFileJustUploaded`. Looks like a typo to me, which is bound to cause an error. – duncan Jun 18 '15 at 21:02
  • It was a typo. I had been playing with various steps to try and see if I could get a different result. Corrected the typo in the code above. Thx – Alex Jun 18 '15 at 21:05
  • Finally (this is turning into a code review, you should probably move the question to http://codereview.stackexchange.com/ ), you have a query to get the `fileupload` column, you then loop over the query but don't do anything with that column. Instead for each iteration of the loop you do `` referring to a PDF called just `FileTransferList`. So multiple iterations repeating the action with the same file... also FileTransferList doesn't sound like a PDF filetype to me, shouldn't it be FileTransferList.pdf? – duncan Jun 18 '15 at 21:06

0 Answers0