How can I delete old file uploads?

If your form includes image uploads you may find after time that they are taking up too much space and older files need to be deleted. Here's a code snippet to do that:
<?php
// change the next line to match your upload folder
// Use this version for Joomla! 2.5 or earlier
$files = glob(JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'uploads'.DS.'*');
// use this version for Joomla! 3 or later
//$files = glob(JPATH_SITE.'/components/com_chronoforms/uploads/*');
// set 'keep' period to 7 days
$checktime = time() - 7 * 24 * 60 * 60;
foreach ( $files as $v ) {
  if ( is_file($v) && filemtime($v) < $checktime ) {
    unlink($v);
  }
}
?>
You could either include this as a Custom Code action in your form, in which case the housekeeping will be done each time the form submits; or you could set it up as a scheduled cron job on the server to run every few days.