public function uploadFile($object, $type, $subtype) { $sheets = new SxModule_Sheets(); $base = realpath(APPLICATION_PATH . '/../public_html/securedocs/'); $path = $type . '/' . $subtype; if (!is_dir($base . '/' . $path)) { echo $base . '/' . $path; mkdir($base . '/' . $type); mkdir($base . '/' . $path); } if ($object->getFile() == null) { $object->setFile(''); } $uploadAdapter = new Zend_File_Transfer_Adapter_Http(); $uploadAdapter->setDestination($base . '/' . $path); $uploadAdapter->setOptions(array('ignoreNoFile' => true)); $uploadAdapter->receive(); $files = $uploadAdapter->getFileName(null, true); foreach ($_FILES['file']['name'] as $key => $filename) { if (!$filename) { continue; } $file = $base . '/' . $path . '/' . $filename; $date = date('Y-m-d His'); $path_info = pathinfo($filename); $myfilename = str_replace(' ', '_', $path_info['filename'] . '_' . $date . '.' . $path_info['extension']); $myfilename = $sheets->createFileName($myfilename); $newfile = $base . '/' . $path . '/' . $myfilename; rename($file, $newfile); $object->setFile($myfilename); } }