> don't know how to use this in a CFMX 7 environment.
> I'm going to use this code to augment unzip code found
> at http://www.rewindlife.com/archives/000041.cfm
You can compile the above code into a java class. Then place the .class file
(or jar) into the CF classpath and reboot. Then you can use the ZipFileVerifier
class in place of java.util.zip.ZipFile in the unZipFile function. Replacing
this line
zipFile = createObject("java", "java.util.zip.ZipFile");
With
zipFile = createObject("java", "path.to.ZipFileVerifier");
I think the rest of the function code remains the same. Another alternative
would be to convert the above code into a CF function. Something like
<cffunction name="verifyZipFile" returntype="struct" output="false">
<cfargument name="pathToFile" type="string" required="true">
<cfset var Local = structNew()>
<cfscript>
Local.results = structNew();
Local.results.InputFile = arguments.pathToFile;
try {
Local.fis = createObject("java",
"java.io.FileInputStream").init(arguments.pathToFile);
Local.zipin = createObject("java",
"java.util.zip.ZipInputStream").init(Local.fis);
while ( Local.zipin.available() EQ 1 ) {
Local.zipin.getNextEntry();
}
Local.results.wasVerified = true;
Local.results.errorMessage = "";
}
catch (java.lang.Exception e) {
Local.results.wasVerified = false;
Local.results.errorMessage = e.message;
}
</cfscript>
<cfreturn Local.results>
</cffunction>
<cfset status = verifyZipFile("c:\path\to\yourZipFile.Zip")>
<cfoutput>
wasVerified = #status.wasVerified#<br>
errorMessage = #status.errorMessage#<br>
InputFile = #status.InputFile#<br>
</cfoutput>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296634
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4