Question : Time out and my script

Hello,

I have a script that downloads images and make a zip. The images are high res images hosted at a S3 account and from a website people can make a zip and download. An image has around 8MB and there are 14 image per each zip. So when user request these images from the website, my script download the images from S3 to server and after 14images are downloaded it create a zip.

I have the image URLs in DB, a function to download remote files, and a zip create function.

I get images to an array, do a foreach for download function and at the end create a zip file from the array.

Problem is after 30 seconds server stop processing the script., But my script need more time .

Is there any good way to overcome this, without changing the time out in php.ini ?

Thank You

Answer : Time out and my script

You can access the command line parameters by declaring your Main function like so:

public static void Main(string[] args)

You'll want to store these somewhere that your WinForm can access them from.  I would suggest a static class (this used to be called a global variable):

public static class ArgHolder
{
  public static Args { get; set; }
}

Now, from Main, you can just call ArgHolder.Args = args;

From your WinForm, you can retrieve these when you need them.

if ( ArgHolder.Args != null && ArgHolder.Args.Length > 0 )
{
  // We have strings, starting with ArgHolder.Args[0]
}

Hope this helps!
Random Solutions  
 
programming4us programming4us