• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getFileExtension函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getFileExtension函数的典型用法代码示例。如果您正苦于以下问题:PHP getFileExtension函数的具体用法?PHP getFileExtension怎么用?PHP getFileExtension使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getFileExtension函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: initialize_page

function initialize_page()
{
    $post_action = "";
    if (isset($_POST['submit'])) {
        $post_action = $_POST['submit'];
    }
    if ($post_action == "Add Document" || $post_action == "Add and Return to List") {
        $name = $_POST['name'];
        $file_type = getFileExtension($_FILES['file']['name']);
        $filename = slug(getFileName($_FILES['file']['name']));
        $filename_string = $filename . "." . $file_type;
        // Check to make sure there isn't already a file with that name
        $possibledoc = Documents::FindByFilename($filename_string);
        if (is_object($possibledoc)) {
            setFlash("<h3>Failure: Document filename already exists!</h3>");
            redirect("admin/add_document");
        }
        $target_path = SERVER_DOCUMENTS_ROOT . $filename_string;
        if (move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
            $new_doc = MyActiveRecord::Create('Documents', array('name' => $name, 'filename' => $filename_string, 'file_type' => $file_type));
            $new_doc->save();
            if (!chmod($target_path, 0644)) {
                setFlash("<h3>Warning: Document Permissions not set; this file may not display properly</h3>");
            }
            setFlash("<h3>Document uploaded</h3>");
        } else {
            setFlash("<h3>Failure: Document could not be uploaded</h3>");
        }
        if ($post_action == "Add and Return to List") {
            redirect("admin/list_documents");
        }
    }
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:33,代码来源:add_document.php


示例2: _initialize

 /**
  * Initialize the upload class
  * @param string $upload The key value of the $_FILES superglobal to use
  */
 private function _initialize($upload)
 {
     $this->_uploadedFile = $upload['name'];
     $this->_tempName = $upload['tmp_name'];
     $this->_fileSize = $upload['size'];
     $this->_extension = getFileExtension($this->_uploadedFile);
     $this->_mimeType = getFileType($this->_tempName);
 }
开发者ID:ITESolutions,项目名称:desktop,代码行数:12,代码来源:Upload.php


示例3: getDatabaseFileExtension

 /**
  * Get file extension for database resource.
  * @param 	$fileId 	Id of file in database to get extension from.
  */
 function getDatabaseFileExtension($fileId)
 {
     global $dbi;
     $result = $dbi->query("SELECT name FROM " . fileTableName . " WHERE id=" . $dbi->quote($fileId));
     if ($result->rows()) {
         list($fileName) = $result->fetchrow_array();
         return convertToLowercase(getFileExtension($fileName));
     }
     return "";
 }
开发者ID:gkathir15,项目名称:catmis,代码行数:14,代码来源:File.class.php


示例4: getFileName

function getFileName($album, $filename)
{
    global $pic_root;
    $ext = getFileExtension($filename);
    $file_name = str_replace("." . $ext, "", $filename);
    $upload_file_name = $file_name;
    $i = 0;
    while (file_exists($pic_root . $album . "/" . $upload_file_name . "." . $ext)) {
        $upload_file_name = $file_name . "-" . ++$i;
    }
    return $upload_file_name . "." . $ext;
}
开发者ID:Kylemurray25,项目名称:wmlmusicguide,代码行数:12,代码来源:pic_upload.php


示例5: listFilesFromType

function listFilesFromType($folder, $type)
{
    $array = array();
    if ($d = opendir($folder)) {
        while (false !== ($file = readdir($d))) {
            if ($file != '.' && $file != '..' && getFileExtension($file) == $type) {
                $array[] .= $folder . "/" . $file;
            }
        }
    }
    return $array;
}
开发者ID:GrottoCenter,项目名称:GrottoCenter,代码行数:12,代码来源:genScriptJS.php


示例6: show_documents

/**
 * Returns an overview of certain documents
 *
 * @param Array $documents Ids of the documents in question
 * @param mixed $open      Array containing open states of documents
 * @return string Overview of documents as html, ready to be displayed
 */
function show_documents($documents, $open = null)
{
    if (!is_array($documents)) {
        return;
    }
    if (!is_null($open) && !is_array($open)) {
        $open = null;
    }
    if (is_array($open)) {
        reset($open);
        $ank = key($open);
    }
    if (!empty($documents)) {
        $query = "SELECT {$GLOBALS['_fullname_sql']['full']} AS fullname, username, user_id,\n                         dokument_id, filename, filesize, downloads, protected, url, description,\n                         IF(IFNULL(name, '') = '', filename, name) AS t_name,\n                         GREATEST(a.chdate, a.mkdate) AS chdate\n                  FROM dokumente AS a\n                  LEFT JOIN auth_user_md5 USING (user_id)\n                  LEFT JOIN user_info USING (user_id)\n                  WHERE dokument_id IN (?)\n                  ORDER BY a.chdate DESC";
        $statement = DBManager::get()->prepare($query);
        $statement->execute(array($documents));
        $documents = $statement->fetchAll(PDO::FETCH_ASSOC);
    }
    foreach ($documents as $index => $document) {
        $type = empty($document['url']) ? 0 : 6;
        $is_open = is_null($open) || $open[$document['dokument_id']] ? 'open' : 'close';
        $extension = getFileExtension($document['filename']);
        // Create icon
        $icon = sprintf('<a href="%s">%s</a>', GetDownloadLink($document['dokument_id'], $document['filename'], $type), GetFileIcon($extension, true)->asImg());
        // Create open/close link
        $link = $is_open === 'open' ? URLHelper::getLink('#dok_anker', array('close' => $document['dokument_id'])) : URLHelper::getLink('#dok_anker', array('open' => $document['dokument_id']));
        // Create title including filesize and number of downloads
        $size = $document['filesize'] > 1024 * 1024 ? sprintf('%u MB', round($document['filesize'] / 1024 / 1024)) : sprintf('%u kB', round($document['filesize'] / 1024));
        $downloads = $document['downloads'] == 1 ? '1 ' . _('Download') : $document['downloads'] . ' ' . _('Downloads');
        $title = sprintf('<a href="%s"%s class="tree">%s</a> (%s / %s)', $link, $ank == $document['dokument_id'] ? ' name="dok_anker"' : '', htmlReady(mila($document['t_name'])), $size, $downloads);
        // Create additional information
        $addon = sprintf('<a href="%s">%s</a> %s', URLHelper::getLink('dispatch.php/profile', array('username' => $document['username'])), $document['fullname'], date('d.m.Y H:i', $document['chdate']));
        if ($document['protected']) {
            $addon = tooltipicon(_('Diese Datei ist urheberrechtlich geschützt!')) . ' ' . $addon;
        }
        if (!empty($document['url'])) {
            $addon .= ' ' . Icon::create('link-extern', 'clickable', ['title' => _('Diese Datei wird von einem externen Server geladen!')])->asImg(16);
        }
        // Attach created variables to document
        $documents[$index]['addon'] = $addon;
        $documents[$index]['extension'] = $extension;
        $documents[$index]['icon'] = $icon;
        $documents[$index]['is_open'] = $is_open;
        $documents[$index]['link'] = $link;
        $documents[$index]['title'] = $title;
        $documents[$index]['type'] = $type;
    }
    $template = $GLOBALS['template_factory']->open('user_activities/files-details');
    $template->documents = $documents;
    return $template->render();
}
开发者ID:ratbird,项目名称:hope,代码行数:58,代码来源:user_activities.php


示例7: move

function move($path, $filename, $newname = null)
{
    $allowed = array('jpg', 'jpeg', 'pdf', 'png', 'xls', 'xlsx', 'zip');
    if (file_exists($_FILES[$filename]['tmp_name'])) {
        if (in_array(getFileExtension(getFileName($filename)), $allowed) && $_FILES[$filename]['error'] == 0) {
            $uploadname = isset($newname) ? $newname : getFileName($filename);
            try {
                move_uploaded_file($_FILES[$filename]['tmp_name'], $path . $uploadname);
            } catch (Exception $e) {
                echo "Error Occurred Uploading File: " . $e->getMessage();
            }
        }
    } else {
        throw new Exception('FILE NOT FOUND');
    }
}
开发者ID:slim12kg,项目名称:Anastat,代码行数:16,代码来源:file.php


示例8: uploadFiletoDB

function uploadFiletoDB($UserFileName)
{
    $TransactionArray = array();
    $TblName = TableName;
    $FileName = $_FILES[$UserFileName]['name'];
    $FileServerName = $_FILES[$UserFileName]['tmp_name'];
    $CSVFIle = 'transactionTable.csv';
    $CSVDelimiter = ';';
    $ValidRecordswrited = 0;
    $InvalidRecords = 0;
    if (getFileExtension($FileName) == 'xlsx') {
        convertXLStoCSV($FileServerName, $CSVFIle);
        $CSVDelimiter = ',';
    } else {
        $CSVFIle = $FileServerName;
    }
    $TransactionArray = csv_to_array($CSVFIle, $CSVDelimiter);
    if (sizeof($TransactionArray) > 100000) {
        echo '<br>';
        echo "Error - file rows cont is to much";
        return false;
    }
    $Connection = mysql_connect(ServerName, UserName, Password);
    $db_selected = mysql_select_db(DBName, $Connection);
    if (!$Connection) {
        die("Connection failed: " . mysql_error());
    }
    foreach ($TransactionArray as $Line) {
        if (checkTransactionRecord($Line)) {
            $Request = "INSERT INTO {$TblName}(`Account`, `Description`, `CurrencyCode`, `Ammount`) VALUES ('{$Line['Account']}','{$Line['Description']}','{$Line['CurrencyCode']}',{$Line['Amount']})";
            $result = mysql_query($Request);
            if (!$result) {
                echo 'Query error: ' . mysql_error();
            } else {
                $ValidRecordswrited++;
            }
        } else {
            $InvalidRecords++;
        }
    }
    mysql_close($Connection);
    echo '<br> <br>';
    echo "Valid records writed to DataBase: {$ValidRecordswrited}";
    echo '<br>';
    echo "Invalid records count: {$InvalidRecords}";
}
开发者ID:pj-infest,项目名称:ElifTechTask,代码行数:46,代码来源:upload.php


示例9: upload_file

function upload_file($tabla, $type, $archivo, $archivo_name)
{
    $s_ = "select * from configuracion where variable='ruta_cargas'";
    $r_ = mysql_query($s_);
    $d_ = mysql_fetch_array($r_);
    $r_server = $d_['valor'];
    $pext = getFileExtension($archivo_name);
    $nombre = date("YmdHis") . "." . $pext;
    $nom_final = $r_server . $nombre;
    if (is_uploaded_file($archivo)) {
        if (!copy($archivo, "{$nom_final}")) {
            echo "<script>alert('Error al subir el archivo: {$nom_final}');</script>";
            upload_form($tabla);
            exit;
        } else {
            insert_csv($tabla, $type, $nombre);
        }
    }
}
开发者ID:BrutalAndSick,项目名称:scrap,代码行数:19,代码来源:fun_modelos.php


示例10: save_uploaded_file

 function save_uploaded_file($tmp_name, $file_name, $isportimg = false, $isentryimg = false, $maxwidth = 0, $maxheight = 0)
 {
     $filetype = getFileExtension($file_name);
     $file_name = slug(basename($file_name, $filetype));
     $new_file_name = $this->id . "-" . $file_name . '.' . $filetype;
     move_uploaded_file($tmp_name, $this->get_local_image_path($new_file_name));
     chmod($this->get_local_image_path($new_file_name), 0644);
     $max_width = 0;
     $max_height = 0;
     if ($maxwidth != 0) {
         $max_width = $maxwidth;
     } elseif ($maxheight != 0) {
         $max_height = $maxheight;
     } elseif ($isportimg) {
         if (defined("MAX_PORTFOLIO_IMAGE_HEIGHT")) {
             $max_height = MAX_PORTFOLIO_IMAGE_HEIGHT;
         }
         if (defined("MAX_PORTFOLIO_IMAGE_WIDTH")) {
             $max_width = MAX_PORTFOLIO_IMAGE_WIDTH;
         }
     } elseif ($isentryimg) {
         if (defined("MAX_ENTRY_IMAGE_HEIGHT")) {
             $max_height = MAX_ENTRY_IMAGE_HEIGHT;
         }
         if (defined("MAX_ENTRY_IMAGE_WIDTH")) {
             $max_width = MAX_ENTRY_IMAGE_WIDTH;
         }
     } else {
         if (defined("MAX_GALLERY_IMAGE_HEIGHT")) {
             $max_height = MAX_GALLERY_IMAGE_HEIGHT;
         }
         if (defined("MAX_GALLERY_IMAGE_WIDTH")) {
             $max_width = MAX_GALLERY_IMAGE_WIDTH;
         }
     }
     $this->filename = $new_file_name;
     $this->save();
     resizeToMultipleMaxDimensions($this->get_local_image_path($new_file_name), $max_width, $max_height, $filetype);
     //$query = "UPDATE photos SET filename = $file_name WHERE id = {$this->id};";
     //return mysql_query( $query, MyActiveRecord::Connection() ) or die( $query );
 }
开发者ID:highchair,项目名称:hcd-trunk,代码行数:41,代码来源:photos.php


示例11: saveFileTo

function saveFileTo($name, $path, $width = 0, $height = 0)
{
    if (!$_FILES[$name]) {
        return;
    }
    if ($_FILES[$name]["error"] != 0) {
        return;
    }
    $tempFile = $_FILES[$name]['tmp_name'];
    $fileName = $_FILES[$name]['name'];
    //$fileSize = $_FILES['Filedata']['size'];
    if (!is_dir(dirname($path))) {
        mkdir(dirname($path), true);
        chmod(dirname($path), 777);
    }
    if ($width == 0) {
        move_uploaded_file($tempFile, $path);
    } else {
        move_uploaded_file($tempFile, $tempFile . "." . getFileExtension($fileName));
        createImage($tempFile . "." . getFileExtension($fileName), $path, $width, $height);
    }
}
开发者ID:qichangjun,项目名称:HTMLLearn,代码行数:22,代码来源:upload.php


示例12: uploadFile

function uploadFile($file, $path, $allowType, $maxSize)
{
    $fileName = $file['name'];
    $ext = getFileExtension($fileName);
    $fileSize = $file['size'];
    $tmpFile = $file['tmp_name'];
    $result = ["error" => [], "path" => ""];
    if ($fileSize > $maxSize) {
        $result['error'][] = ["msg" => "Exceeded filesize limit (" . $maxSize / 1000000 . "MB)"];
    }
    if (count($result['error']) == 0) {
        $fileName = time() . "_" . $fileName;
        if (!is_dir(getcwd() . $path)) {
            mkdir($path, 0777, true);
        }
        $path = $path . "/" . $fileName;
        if (move_uploaded_file(stmpFile, getcwd() . $path)) {
            $result['path'] = $path;
        } else {
            $result['error'][] = ["msg" => " Error on upload file : Permission denied"];
        }
    }
    return $result;
}
开发者ID:dieucay88,项目名称:dieucay88.github.io,代码行数:24,代码来源:global.php


示例13: getMIMEType

function getMIMEType($ext, $filename = null)
{
    if ($filename) {
        return getMIMEType(getFileExtension($filename));
    } else {
        switch (strtolower($ext)) {
            // Image
            case 'gif':
                return 'image/gif';
            case 'jpeg':
            case 'jpg':
            case 'jpe':
                return 'image/jpeg';
            case 'png':
                return 'image/png';
            case 'tiff':
            case 'tif':
                return 'image/tiff';
            case 'bmp':
                return 'image/bmp';
                // Sound
            // Sound
            case 'wav':
                return 'audio/x-wav';
            case 'mpga':
            case 'mp2':
            case 'mp3':
                return 'audio/mpeg';
            case 'm3u':
                return 'audio/x-mpegurl';
            case 'wma':
                return 'audio/x-msaudio';
            case 'ra':
                return 'audio/x-realaudio';
                // Document
            // Document
            case 'css':
                return 'text/css';
            case 'html':
            case 'htm':
            case 'xhtml':
                return 'text/html';
            case 'rtf':
                return 'text/rtf';
            case 'sgml':
            case 'sgm':
                return 'text/sgml';
            case 'xml':
            case 'xsl':
                return 'text/xml';
            case 'hwp':
            case 'hwpml':
                return 'application/x-hwp';
            case 'pdf':
                return 'application/pdf';
            case 'odt':
            case 'ott':
                return 'application/vnd.oasis.opendocument.text';
            case 'ods':
            case 'ots':
                return 'application/vnd.oasis.opendocument.spreadsheet';
            case 'odp':
            case 'otp':
                return 'application/vnd.oasis.opendocument.presentation';
            case 'sxw':
            case 'stw':
                return '	application/vnd.sun.xml.writer';
            case 'sxc':
            case 'stc':
                return '	application/vnd.sun.xml.calc';
            case 'sxi':
            case 'sti':
                return '	application/vnd.sun.xml.impress';
            case 'doc':
                return 'application/vnd.ms-word';
            case 'xls':
            case 'xla':
            case 'xlt':
            case 'xlb':
                return 'application/vnd.ms-excel';
            case 'ppt':
            case 'ppa':
            case 'pot':
            case 'pps':
                return 'application/vnd.mspowerpoint';
            case 'vsd':
            case 'vss':
            case 'vsw':
                return 'application/vnd.visio';
            case 'docx':
            case 'docm':
            case 'pptx':
            case 'pptm':
            case 'xlsx':
            case 'xlsm':
                return 'application/vnd.openxmlformats';
            case 'csv':
                return 'text/comma-separated-values';
                // Multimedia
            // Multimedia
//.........这里部分代码省略.........
开发者ID:ragi79,项目名称:Textcube,代码行数:101,代码来源:file.php


示例14: while

$outputFiles = '';
while (false !== ($file = readdir($handle))) {
    $previewFile = getPreviewFileFromLive(DIR . '/' . $file);
    if (strstr($file, 'phpthumb') || strstr($file, 'phpthumb') || !file_exists($previewFile)) {
        continue;
    }
    if (!in_array($file, $reserved_filenames)) {
        $itemsFound++;
        if (is_dir(DIR . '/' . $file)) {
            // Directory
            $outputDirs .= "\n<li class=\"dir\">";
            $outputDirs .= '<a href="?dir=' . DIR . '/' . $file . '" title="Browse ' . $file . '">';
            $outputDirs .= $file;
            $outputDirs .= '</a></li>';
        } else {
            if (getFileExtension($file) == 'html' || getFileExtension($file) == 'php') {
                // File
                $outputFiles .= "\n" . '<li class="file"><a href="javascript:selectPage(\'' . DIR . '/' . $file . '\');" >';
                $outputFiles .= $file;
                $outputFiles .= '</a>';
                $outputFiles .= "\n</li>";
            }
        }
    }
}
closedir($handle);
if ($itemsFound > 0) {
    $outputHTML = '<div class="bigLinks"><ul>' . $outputDirs . $outputFiles . '<!-- 3 --></ul></div>';
} else {
    $outputHTML .= '<div><span class="info">No files or folders found</span></div>';
}
开发者ID:chrismunden,项目名称:cmsfromscratch,代码行数:31,代码来源:select-page.php


示例15: guardar_1

function guardar_1($partes, $partes_name, $comentario, $accion_correctiva)
{
    $s_ = "select * from configuracion where variable='ruta_capturas'";
    $r_ = mysql_query($s_);
    $d_ = mysql_fetch_array($r_);
    $r_server = $d_['valor'];
    $pext = getFileExtension($partes_name);
    $nombre_ = "partes_UID" . $_SESSION["IDEMP"] . "." . $pext;
    $nom_final_ = $r_server . $nombre_;
    if (is_uploaded_file($partes)) {
        if (!copy($partes, "{$nom_final_}")) {
            echo "<script>alert('Error al subir el archivo de partes: {$nom_final_}');</script>";
            nuevo($comentario, $accion_correctiva);
            exit;
        }
    }
    insert_csv($nombre_, $comentario, $accion_correctiva);
}
开发者ID:BrutalAndSick,项目名称:scrap,代码行数:18,代码来源:scrap_archivo_35.php


示例16: processActionCommit

 protected function processActionCommit()
 {
     $this->checkRequiredPostParams(array('editSessionId'));
     if ($this->errorCollection->hasErrors()) {
         $this->sendJsonErrorResponse();
     }
     $this->checkUpdatePermissions();
     $currentSession = $this->getEditSessionByCurrentUser((int) $this->request->getPost('editSessionId'));
     if (!$currentSession) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_COULD_NOT_FIND_EDIT_SESSION'), self::ERROR_COULD_NOT_FIND_EDIT_SESSION)));
         $this->sendJsonErrorResponse();
     }
     $tmpFile = \CTempFile::getFileName(uniqid('_wd'));
     checkDirPath($tmpFile);
     $fileData = new FileData();
     $fileData->setId($currentSession->getServiceFileId());
     $fileData->setSrc($tmpFile);
     $newNameFileAfterConvert = null;
     if ($this->documentHandler->isNeedConvertExtension($this->file->getExtension())) {
         $newNameFileAfterConvert = getFileNameWithoutExtension($this->file->getName()) . '.' . $this->documentHandler->getConvertExtension($this->file->getExtension());
         $fileData->setMimeType(TypeFile::getMimeTypeByFilename($newNameFileAfterConvert));
     } else {
         $fileData->setMimeType(TypeFile::getMimeTypeByFilename($this->file->getName()));
     }
     $fileData = $this->documentHandler->downloadFile($fileData);
     if (!$fileData) {
         if ($this->documentHandler->isRequiredAuthorization()) {
             $this->sendNeedAuth();
         }
         $this->errorCollection->add($this->documentHandler->getErrors());
         $this->sendJsonErrorResponse();
     }
     $this->deleteEditSession($currentSession);
     $oldName = $this->file->getName();
     //rename in cloud service
     $renameInCloud = $fileData->getName() && $fileData->getName() != $this->file->getName();
     if ($newNameFileAfterConvert || $renameInCloud) {
         if ($newNameFileAfterConvert && $renameInCloud) {
             $newNameFileAfterConvert = getFileNameWithoutExtension($fileData->getName()) . '.' . getFileExtension($newNameFileAfterConvert);
         }
         $this->file->rename($newNameFileAfterConvert);
     }
     $fileArray = \CFile::makeFileArray($tmpFile);
     $fileArray['name'] = $this->file->getName();
     $fileArray['type'] = $fileData->getMimeType();
     $fileArray['MODULE_ID'] = Driver::INTERNAL_MODULE_ID;
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $fileId = \CFile::saveFile($fileArray, Driver::INTERNAL_MODULE_ID);
     if (!$fileId) {
         \CFile::delete($fileId);
         $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_COULD_NOT_SAVE_FILE'), self::ERROR_COULD_NOT_SAVE_FILE)));
         $this->sendJsonErrorResponse();
     }
     $versionModel = $this->file->addVersion(array('ID' => $fileId, 'FILE_SIZE' => $fileArray['size']), $this->getUser()->getId(), true);
     if (!$versionModel) {
         \CFile::delete($fileId);
         $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_COULD_NOT_ADD_VERSION'), self::ERROR_COULD_NOT_ADD_VERSION)));
         $this->errorCollection->add($this->file->getErrors());
         $this->sendJsonErrorResponse();
     }
     if ($this->isLastEditSessionForFile()) {
         $this->deleteFile($currentSession, $fileData);
     }
     $this->sendJsonSuccessResponse(array('objectId' => $this->file->getId(), 'newName' => $this->file->getName(), 'oldName' => $oldName));
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:65,代码来源:documentcontroller.php


示例17: guardar

function guardar($turno, $proyecto, $area, $area_2, $estacion, $estacion_2, $linea, $linea_2, $defecto, $defecto_2, $causa, $causa_2, $codigo_scrap, $codigo_scrap_2, $supervisor, $operador, $no_personal, $apd, $o_mantto, $docto_sap, $info_1, $info_2, $comentario, $accion_correctiva, $archivo, $archivo_name)
{
    $error = 0;
    $fecha = date("Y-m-d");
    $hora = date("H:i:s");
    $anio = date("Y");
    list($anio, $mes, $dia) = split("-", $fecha);
    $semana = date('W', mktime(0, 0, 0, $mes, $dia, $anio));
    $folio = get_folio();
    $i = 0;
    aumenta_folio();
    //Validar que el folio no esté duplicado
    $s_ = "select * from scrap_folios where no_folio='{$folio}'";
    $r_ = mysql_query($s_);
    if (mysql_num_rows($r_) > 0) {
        $movimiento = "El folio esta duplicado.";
        $error++;
    }
    if ($archivo != '') {
        $s_ = "select * from configuracion where variable='ruta_evidencias'";
        $r_ = mysql_query($s_);
        $d_ = mysql_fetch_array($r_);
        $r_server = $d_['valor'];
        $pext = getFileExtension($archivo_name);
        $nombre = "evidencia_" . $folio . "." . $pext;
        $nom_final = $r_server . $nombre;
        if (is_uploaded_file($archivo)) {
            if (!copy($archivo, "{$nom_final}")) {
                echo "<script>alert('Error al subir el archivo de evidencias: {$nom_final}');</script>";
            }
        }
    }
    $folios[$i] = $_SESSION['IDEMP'];
    $i++;
    $folios[$i] = $_SESSION['NAME'];
    $i++;
    $folios[$i] = $folio;
    $i++;
    $folios[$i] = $fecha;
    $i++;
    $folios[$i] = $hora;
    $i++;
    $folios[$i] = $semana;
    $i++;
    $folios[$i] = $anio;
    $i++;
    $folios[$i] = $turno;
    $i++;
    $d_pr = get_datos_proyecto($proyecto);
    $folios[$i] = $d_pr['id_pr'];
    $i++;
    //ID Proyecto
    $folios[$i] = $d_pr['nom_pr'];
    $i++;
    //Nombre Proyecto
    $folios[$i] = $d_pr['id_p'];
    $i++;
    //ID Planta
    $folios[$i] = $d_pr['nom_p'];
    $i++;
    //Nombre Planta
    $folios[$i] = $d_pr['id_d'];
    $i++;
    //ID División
    $folios[$i] = $d_pr['nom_d'];
    $i++;
    //Nombre División
    $folios[$i] = $d_pr['id_s'];
    $i++;
    //ID Segmento
    $folios[$i] = $d_pr['nom_s'];
    $i++;
    //Nombre Segmento
    $folios[$i] = $d_pr['id_pc'];
    $i++;
    //ID ceco
    $folios[$i] = $d_pr['nom_pc'];
    $i++;
    //Nombre ceco
    $folios[$i] = $apd;
    $i++;
    $folios[$i] = get_dato("nombre", $apd, "apd");
    $i++;
    $folios[$i] = $area;
    $i++;
    $folios[$i] = get_dato("nombre", $area, "areas");
    $i++;
    $folios[$i] = $estacion;
    $i++;
    $folios[$i] = get_dato("nombre", $estacion, "estaciones");
    $i++;
    $folios[$i] = $linea;
    $i++;
    $folios[$i] = get_dato("nombre", $linea, "lineas");
    $i++;
    $folios[$i] = $defecto;
    $i++;
    $folios[$i] = get_dato("nombre", $defecto, "defectos");
    $i++;
    $folios[$i] = $causa;
//.........这里部分代码省略.........
开发者ID:BrutalAndSick,项目名称:scrap,代码行数:101,代码来源:scrap_masiva.php


示例18: purgeFiles

function purgeFiles($temp_dir, $purge_time_limit, $file_type, $debug_ajax = 0)
{
    //$now_time = mktime();
    $now_time = time();
    if (@is_dir($temp_dir)) {
        if ($dp = @opendir($temp_dir)) {
            while (($file_name = readdir($dp)) !== false) {
                if ($file_name !== '.' && $file_name !== '..' && strcmp(getFileExtension($file_name), $file_type) == 0) {
                    if ($file_time = @filectime($temp_dir . $file_name)) {
                        if ($now_time - $file_time > $purge_time_limit) {
                            @unlink($temp_dir . $file_name);
                        }
                    }
                }
            }
            closedir($dp);
        } else {
            if ($debug_ajax) {
                showDebugMessage('Failed to open temp_dir ' . $temp_dir);
            }
            showAlertMessage("<span class='ubrError'>ERROR</span>: Failed to open temp_dir", 1);
        }
    } else {
        if ($debug_ajax) {
            showDebugMessage('Failed to find temp_dir ' . $temp_dir);
        }
        showAlertMessage("<span class='ubrError'>ERROR</span>: Failed to find temp_dir", 1);
    }
}
开发者ID:sushilfl88,项目名称:test-uber,代码行数:29,代码来源:ubr_lib.php


示例19: directoryToMultiArray

/**
 * Return a directory of files and folders with heirarchy and additional data
 *
 * @since 3.1.3
 *
 * @param $directory string directory to scan
 * @param $recursive boolean whether to do a recursive scan or not.
 * @param $exts array file extension include filter, array of extensions to include
 * @param $exclude bool true to treat exts as exclusion filter instead of include
 * @return multidimensional array or files and folders {type,path,name}
 */
function directoryToMultiArray($dir, $recursive = true, $exts = null, $exclude = false)
{
    // $recurse is not implemented
    $result = array();
    $dir = rtrim($dir, DIRECTORY_SEPARATOR);
    $cdir = scandir($dir);
    foreach ($cdir as $key => $value) {
        if (!in_array($value, array(".", ".."))) {
            if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) {
                if (!$recursive) {
                    continue;
                }
                $path = preg_replace("#\\\\|//#", "/", $dir . '/' . $value . '/');
                $result[$value] = array();
                $result[$value]['type'] = "directory";
                $result[$value]['path'] = $path;
                $result[$value]['dir'] = $value;
                $result[$value]['value'] = call_user_func(__FUNCTION__, $path, $recursive, $exts, $exclude);
            } else {
                $path = preg_replace("#\\\\|//#", "/", $dir . '/');
                // filetype filter
                $ext = getFileExtension($value);
                if (is_array($exts)) {
                    if (!in_array($ext, $exts) and !$exclude) {
                        continue;
                    }
                    if ($exclude and in_array($ext, $exts)) {
                        continue;
                    }
                }
                $result[$value] = array();
                $result[$value]['type'] = 'file';
                $result[$value]['path'] = $path;
                $result[$value]['value'] = $value;
            }
        }
    }
    return $result;
}
开发者ID:kix23,项目名称:GetSimpleCMS,代码行数:50,代码来源:basic.php


示例20: update

function update($folio, $turno, $proyecto, $area, $area_2, $estacion, $estacion_2, $linea, $linea_2, $defecto, $defecto_2, $causa, $causa_2, $codigo_scrap, $codigo_scrap_2, $supervisor, $operador, $no_personal, $apd, $o_mantto, $docto_sap, $info_1, $info_2, $comentario, $accion_correctiva, $from, $archivo, $archivo_name)
{
    //Obtengo el código de scrap viejo
    $s_2 = "select archivo, codigo_scrap from scrap_folios where no_folio='{$folio}'";
    $r_2 = mysql_query($s_2);
    $d_2 = mysql_fetch_array($r_2);
    $cod = $d_2['codigo_scrap'];
    //Obtengo el id del autorizador que había rechazado
    $s_1 = "select id_emp, depto from autorizaciones where no_folio='{$folio}' and status='2'";
    $r_1 = mysql_query($s_1);
    $d_1 = mysql_fetch_array($r_1);
    $emp = $d_1['id_emp'];
    //Borro todo de la boleta para volver a ingresarlo
    $s_1 = "delete from scrap_partes where no_folio='{$folio}'";
    $r_1 = mysql_query($s_1);
    $s_1 = "delete from scrap_folios where no_folio='{$folio}'";
    $r_1 = mysql_query($s_1);
    $s_1 = "delete from scrap_codigos where no_folio='{$folio}'";
    $r_1 = mysql_query($s_1);
    if ($archivo != '') {
        $s_ = "select * from configuracion where variable='ruta_evidencias'";
        $r_ = mysql_query($s_);
        $d_ = mysql_fetch_array($r_);
        $r_server = $d_['valor'];
        $pext = getFileExtension($archivo_name);
        $nombre = "evidencia_" . $folio . "." . $pext;
        $nom_final = $r_server . $nombre;
        if (file_exists($nom_final)) {
            unlink($nom_final);
        }
        if (is_uploaded_file($archivo)) {
            if (!copy($archivo, "{$nom_final}")) {
                echo "<script>alert('Error al subir el archivo: {$nom_final}');</script>";
            }
        }
    } else {
        $nombre = $old;
    }
    $fecha = date("Y-m-d");
    $anio = date("Y");
    list($anio, $mes, $dia) = split("-", $fecha);
    $semana = date('W', mktime(0, 0, 0, $mes, $dia, $anio));
    $i = 0;
    $folios[$i] = $_SESSION['IDEMP'];
    $i++;
    $folios[$i] = $_SESSION['NAME'];
    $i++;
    $folios[$i] = $folio;
    $i++;
    $folios[$i] = $fecha;
    $i++;
    $folios[$i] = $semana;
    $i++;
    $folios[$i] = $anio;
    $i++;
    $folios[$i] = $turno;
    $i++;
    $d_pr = get_datos_proyecto($proyecto);
    $folios[$i] = $d_pr['id_pr'];
    $i++;
    //ID Proyecto
    $folios[$i] = $d_pr['nom_pr'];
    $i++;
    //Nombre Proyecto
    $folios[$i] = $d_pr['id_p'];
    $i++;
    //ID Planta
    $folios[$i] = $d_pr['nom_p'];
    $i++;
    //Nombre Planta
    $folios[$i] = $d_pr['id_d'];
    $i++;
    //ID División
    $folios[$i] = $d_pr['nom_d'];
    $i++;
    //Nombre División
    $folios[$i] = $d_pr['id_s'];
    $i++;
    //ID Segmento
    $folios[$i] = $d_pr['nom_s'];
    $i++;
    //Nombre Segmento
    $folios[$i] = $d_pr['id_pc'];
    $i++;
    //ID ceco
    $folios[$i] = $d_pr['nom_pc'];
    $i++;
    //Nombre ceco
    $folios[$i] = $apd;
    $i++;
    $folios[$i] = get_dato("nombre", $apd, "apd");
    $i++;
    $folios[$i] = $area;
    $i++;
    $folios[$i] = get_dato("nombre", $area, "areas");
    $i++;
    $folios[$i] = $estacion;
    $i++;
    $folios[$i] = get_dato("nombre", $estacion, "estaciones");
    $i++;
//.........这里部分代码省略.........
开发者ID:BrutalAndSick,项目名称:scrap,代码行数:101,代码来源:scrap_edicion.php



注:本文中的getFileExtension函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getFileExtention函数代码示例发布时间:2022-05-15
下一篇:
PHP getFileExt函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap