* urgent * zips/flex Coldfusion downloads the zip before zip is finished!

Hi all

I'm unable to know what to do here.

I send pictures to flex coldfusion and use cfzip to create a zip of images by download.

I use fileRef.download to download the zip to the computer of the user file in actionscript.

The problem is that flex will allow the user to download the zip before it is finished compiling.

So if there are 68 images in the zip on the Web server, depending on the speed you select save location you could get only 42... or 29... etc.

I tried to put the download feature in the back of the remote object coldfusion Manager, but fileRef.download must be run by a click of the mouse for security reasons.

Here's the Manager click the button "download images".

Here's the flex below code:

public void clickHandler1(event:Event):void
{
imgStyleNumber = new ArrayCollection collection;
h = 0;

randomFileNum = Math.round (Math.random () *(99999-11111)) + 11111;

var t:int;
for (t = 0; t < HiResImageCollection.length; t ++)
{

imgStyleNumber.addItem ({ind:StyleNumberCollection [h] + "_" + ColorCollection [h] + pORiCollection [h]});
h = h + 1;
}
cfcquer4.getCartImages (HiResImageCollection, imgStyleNumber, randomFileNum);

downloadURL.url = " " http://localhost/Hib/ImagesTemp/DownloadedImages "+ randomFileNum +".zip"+"? "+ Math.Random ();        

fileRef.download (downloadURL, 'DownloadedImages' + randomFileNum + '.zip');
}


And here is the coldfusion cfc.


< cfproperty >

< cffunction = access "getCartImages" name = "remote" returntype = "Any" >
< cfargument name = "HiResImageCollection" required = "true" >
< cfargument name = "imgStyleNumber" required = "true" >
< cfargument name = "randomFileNum" required = "true" >

< cfset filepath = "C:\Inetpub\wwwroot\HIB\ImagesTemp\DownloadedImages" & #randomFileNum # & ".zip" >
< cfset i = 1 >

< cfloop index = array 'image' = #HiResImageCollection # >


< cfset q = toString(imgStyleNumber[#i#].ind) >
< cfset destpath = "C:\Inetpub\wwwroot\HIB\ImagesTemp\" & #q # & ".jpg" >
< cfimage action = "Write" source = destination #image # = #destpath # >
< cfzip action = "zip" source = file #destpath # = #filepath # > < / cfzip >
< cffile action = "delete file" = #destpath # >
< cfset i = #i # + 1 >
< / cfloop >

< / cffunction >






























< / cfproperty >

Thank you for your help if necessary.

JK

JK, I thought you could just update the existing button. Using the same approach, we discussed (result managers, etc.). CF returns his view that the zip is made to change the label of the button and apply a new click handler. Then when that click event fires, call your method of download (you can listen to download complete and return the button back to its original state. Just a thought

Tags: ColdFusion

Similar Questions

Maybe you are looking for