Login
Please enter your email address and password to login to the help desk.
(leave blank if you forgot your password)
   Save my login information
 

IMPORTANT NOTE:

DUE TO STUCTURAL CHANGES, THE TICKET SYSTEM IS NO LONGER ACCEPTING TICKETS. IF YOU ARE A PAYING SUBSCRIBER, PLEASE LOGIN TO THE CROSSTEC SITE AND USE THE CLUB FORUMS. THE CLUB FORUMS CATEGORY WILL APPEAR RIGHT AFTER LOGIN IF YOU ARE A PAYING CUSTOMER:

>>> Click here to access the forums <<<

We will close the knowledgebase soon as well and move its contents into a new knowledgebase system.

Knowledge Base » BreezingForms » FAQ
File Upload Timestamp Fix

 

When files are being uploaded, the timestamp appears in the extension. Is there a way to make it appear before the filename instead?

This code will add the date before the filename and keeps the extension intact.

In Build 730 and higher, open the following file:

/components/com_breezingforms/facileforms.process.php

in Build 729 and lower, open the following file:

/components/com_facileforms/facileforms.process.php

 

Look for:

line 3821 (normal upload)

      $path = $baseDir.'/'.$userfile_name;
      if ($timestamp) $path .= '.'.date('YmdHis');
      if (file_exists($path)) {
            $rnd = md5( mt_rand(0, mt_getrandmax()) );
            $path = $baseDir.'/'.$rnd.'_'.$userfile_name;
            if ($timestamp) $path .= '.'.date('YmdHis');
            if (file_exists($path)) {
                  $this->status = _FF_STATUS_UPLOAD_FAILED;
                  $this->message = BFText::_('PROCESS_FILEEXISTS');
                  return '';
            }
      } // if

Replace it with:

if ($timestamp) $time_path = date('YmdHis')."_";
      $path = $baseDir.'/'.$time_path.$userfile_name;
      if (file_exists($path)) {
            $this->status = _FF_STATUS_UPLOAD_FAILED;
            $this->message = BFText::_('PROCESS_FILEEXISTS');
       return '';
      } // if


Next, find:

line 3916 (flash upload)

    $path = $baseDir.'/'.$userfile_name;
    if ($row->flag1) $path .= '.'.date('YmdHis');
    if (file_exists($path)) {
          $rnd = md5( mt_rand(0, mt_getrandmax()) );
          $path = $baseDir.'/'.$rnd.'_'.$userfile_name;
          if ($row->flag1) $path .= '.'.date('YmdHis');
          if (file_exists($path)) {
                $this->status = _FF_STATUS_UPLOAD_FAILED;
                $this->message = BFText::_('PROCESS_FILEEXISTS');
                return '';
          }
    } // if


Replace it with:

    if ($row->flag1) $time_path = date('YmdHis')."_";
          $path = $baseDir.'/'.$time_path.$userfile_name;
          if (file_exists($path)) {
                $this->status = _FF_STATUS_UPLOAD_FAILED;
                $this->message = BFText::_('PROCESS_FILEEXISTS');
           return '';
    } // if

 

Thanks to Stefan Mortelmans for contributing the code!


Was this helpful? Yes No Print Pdf