Seamus, after several problems regarding open corrupted zip files I'm using
this code to validate before open that:

<cfscript>
var local = {};
 local.pathZip = arguments.pathZip;
local.pathEXE = application.dir_exe  & '7z ';
</cfscript>

<cfset local.command = 'cmd /c ' & local.pathEXE & ' t ' & local.pathZip>
<cfset resposta = application.SystemCommand.execute( local.command )>

<cfif Len( Trim( resposta.errorOutput ) ) OR Len( Trim(
resposta.executeError ) ) OR NOT Len( Trim( resposta.standardOutput ) )>
<cfreturn false>
</cfif>

<cfif StructKeyExists( resposta, 'standardOutput' ) AND Len(
resposta.standardOutput ) AND FindNoCase( 'Everything is
Ok',resposta.standardOutput )>
 <cfreturn true>
<cfelse>
<cfreturn false>
</cfif>

Do you need the 7-zip application installed in your server and
SystemCommand CFC.

Cheers

Marco Antonio


On Tue, Nov 20, 2012 at 9:12 PM, Seamus Campbell
<coldfus...@boldacious.com>wrote:

>
> Is there any to check the validity of a zip file with cfzip. I can't see
> anything in the docs.
> The only way I could see was to do a cftry, but that seemed cumbersome.
> My problem is that I receive a zipped file from an external source, so
> need to be able to verify that it is a valid zip file
> Many thanks
> Seamus
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353309
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to