Appendix C - PHP3 Script Examples
Axis Communications AB does not provide support for application development of any kind. The
information here is provided "as is", and there is no guarantee that any of the examples shown
will work in your particular application.
Revision 0.9 May 2001
$dest .= ".jpg";
error_reporting(0);
if(is_file($source_file))
{
if(!ftp_put($session, $dest, $source_file,
FTP_BINARY))
{
$failures++;
error_log("Could not upload file
".$source_file." as ".$dest." on
".$ftp_server,0);
}
else
{
$failures=0;
unlink($source_file);
}
}
else
{
error_reporting(E_ALL);
$failures++;
error_log("No such file:
".$source_file,0);
}
$current_time = gettimeofday();
$ellapsed = ($current_time["sec"] -
$loop_start["sec"]) * 1000000;
if($current_time["usec"] > $loop_start["usec"])
$ellapsed += $current_time["usec"] -
$loop_start["usec"];
else
$ellapsed -= $current_time["usec"] -
$loop_start["usec"];
$wait = ($delay * 1000) / strlen($sources);
if($ellapsed < $wait)
{
usleep($wait - $ellapsed);
}
$session_time = ($current_time["sec"] -
$start_time["sec"]);
// If the source file is a
//present
// Upload the source file
// If successful upload,
//remove the uploaded file
//indicating capture of a new
//image
// Wait if needed (in order to
//follow the delay specified
//and spread the traffic)
// Calculate session time
48
Need help?
Do you have a question about the 2400 - PHP3 GUIDE and is the answer not in the manual?
Questions and answers