Jump to content

premature code execution


rubing

Recommended Posts

My php code seems to be executing prematurely.  I am trying to download a file and then delete it if it is too small as follows:

 

//this just tells curl to save a file ($file) and print info about the transfer
$grab->get_file($url,$conn,$proxy);

if (filesize($file)>60000)
{
                echo "file was too small";
	unlink($file);
}

 

 

Now, the file i am downloading is big enough and curl reports that back to me, but php is detecting as too small and deleting it:

 

 

Why do I think this is b/c php is prematurely executing my code????  Glad you asked!  If I change filesize to a smaller number e.g. 30,000  then it will work!  Maybe this is a bug  ???

 

//this just tells curl to save a file ($file) and print info about the transfer
$grab->get_file($url,$conn,$proxy);

if (filesize($file)>30000)
{
                echo "file was too small";
	unlink($file);
}

Link to comment
https://forums.phpfreaks.com/topic/133939-premature-code-execution/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.