Coldfusion 9 Flash Multifile Upload Widget fails due to unrelated code

101 views Asked by At

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>
0

There are 0 answers