本文整理汇总了PHP中findexts函数的典型用法代码示例。如果您正苦于以下问题:PHP findexts函数的具体用法?PHP findexts怎么用?PHP findexts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了findexts函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getXMLs
function getXMLs($comp, $dept, $course)
{
$dir = @opendir("CaptivateResults" . "/" . $comp . "/" . $dept . "/" . $course);
$directory = "CaptivateResults" . "/" . $comp . "/" . $dept . "/" . $course;
while (($file = readdir($dir)) !== false) {
if (!is_dir($file) && findexts($file) == 'xml') {
echo $file . "," . number_format(filectime($directory . "/" . $file), 0, '.', '') . ";";
}
}
closedir($dir);
}
示例2: CleanFileName
function CleanFileName($Raw, $extra = 0)
{
$Raw = trim($Raw);
$extension = findexts($Raw);
$Raw = substr($Raw, 0, -strlen($extension));
//$RemoveChars = array( "([\40])" , "([^a-zA-Z0-9-])", "(-{2,})" );
$RemoveChars = array('/[^a-zA-Z0-9 -]/', '/[ -]+/', '/^-|-$/');
//$ReplaceWith = array("-", "", "-");
$ReplaceWith = array("", "-", "");
$Raw = preg_replace($RemoveChars, $ReplaceWith, $Raw);
$Raw .= $extra == 0 ? "" : $extra;
$Raw .= "." . $extension;
return $Raw;
}
示例3: updateCarMovie
public function updateCarMovie($carmovie)
{
$error = false;
//url
if (trim($carmovie->getUrl()) == "") {
$phpError["carmovieurl"] = "Url is a required field!";
$error = true;
} elseif ($carmovie->getTypeId() == 1) {
if (strtolower(findexts($carmovie->getUrl())) != "wmv" && strtolower(findexts($carmovie->getUrl())) != "mp4") {
$phpError["carmovieurl"] = "LR link must be a wmv or mp4 file!";
$error = true;
}
} elseif ($carmovie->getTypeId() == 2) {
if (strtolower(findexts($carmovie->getUrl())) != "mpg" && strtolower(findexts($carmovie->getUrl())) != "mpeg" && strtolower(findexts($carmovie->getUrl())) != "mov" && strtolower(findexts($carmovie->getUrl())) != "mp4") {
$phpError["carmovieurl"] = "HR link must be mpg, mpeg, mov or mp4 file!";
$error = true;
}
} elseif ($carmovie->getTypeId() == 3) {
if (!isValidURL(trim($carmovie->getUrl()))) {
$phpError["carmovieurl"] = "Not a valid link!";
$error = true;
}
} elseif ($carmovie->getTypeId() == 4) {
//to be defined
} elseif ($carmovie->getTypeId() == 5) {
//to be defined
} else {
$phpError["carmovieurl"] = "Type not found!";
$error = true;
}
//text
if (trim($carmovie->getText()) == "") {
$phpError["carmovietext"] = "Text is a required field!";
$error = true;
}
//car
$dalCar = new DALCar();
$nrCars = $dalCar->getCarCount($carmovie->getCarId());
if ($nrCars == 0) {
$phpError["carmoviecar"] = "Car not found!";
$error = true;
}
if ($error == true) {
return $phpError;
} else {
parent::updateCarMovie($carmovie);
return $carmovie->getId();
}
}
示例4: mime_content_type
function mime_content_type($file)
{
//Guess the mimetype based on extension
if (is_dir($file)) {
return "text/directory";
}
import("api.fs_mimetypes");
global $fs_mimetypes;
$ext = findexts($file);
foreach ($fs_mimetypes as $key => $value) {
if ($ext == $key) {
return $value;
}
$exts = explode($key, " ");
if (count($exts) > 0) {
foreach ($exts as $check) {
if ($ext == $check) {
return $value;
}
}
}
}
return "text/plain";
}
示例5: findexts
}
}
function findexts($filename)
{
$filename = strtolower($filename);
$exts = split("[/\\.]", $filename);
$n = count($exts) - 1;
$exts = $exts[$n];
return $exts;
}
$target_path2 = "";
$target_path2 = "../../pdf/ad_files/";
$base_name2 = "";
if ($_FILES['ad_print']['name'] != "") {
$random = rand(9999, 999999);
$base_name2 = $random . "-" . $_SESSION["user_id"] . "." . findexts(basename($_FILES['ad_print']['name']));
$target_path2 .= $base_name2;
if (move_uploaded_file($_FILES['ad_print']['tmp_name'], $target_path2)) {
$array['ad_link'] = $base_name2;
}
}
for ($i = 1; $i <= 7; $i++) {
$val = "duty" . $i;
if (isset($_POST[$val])) {
$array[$val] = $_POST[$val];
}
}
for ($i = 1; $i <= 26; $i++) {
$val = "hide" . $i;
if (isset($_POST[$val])) {
$array[$val] = $_POST[$val];
示例6: findexts
exit;
//new
} else {
echo "<script>alert('Authentication Error.');</script>";
}
} else {
if (isset($_POST['sellProductSubmitButton'])) {
$ext = findexts($_FILES['product_link1']['name']);
$newfilename = random_string('10') . "." . $ext;
$location1 = "files/" . $newfilename;
move_uploaded_file($_FILES["product_link1"]["tmp_name"], "files/" . $newfilename);
$ext = findexts($_FILES['product_link2']['name']);
$newfilename = random_string('10') . "." . $ext;
$location2 = "files/" . $newfilename;
move_uploaded_file($_FILES["product_link2"]["tmp_name"], "files/" . $newfilename);
$ext = findexts($_FILES['product_link3']['name']);
$newfilename = random_string('10') . "." . $ext;
$location3 = "files/" . $newfilename;
move_uploaded_file($_FILES["product_link3"]["tmp_name"], "files/" . $newfilename);
$user_id = mysql_real_escape_string($_SESSION['bns_id']);
$productName = mysql_real_escape_string($_POST['product_name']);
$productQuantity = mysql_real_escape_string($_POST['product_quantity']);
$productPrice = mysql_real_escape_string($_POST['product_price']);
$productDescription = mysql_real_escape_string($_POST['product_description']);
$productCategory = mysql_real_escape_string($_POST['categoryName']);
$productSubCategory = mysql_real_escape_string($_POST['subCategoryName']);
$i = 0;
$sql = "SELECT * FROM fields WHERE sub_category_id='{$productSubCategory}'";
$result = mysql_query($sql);
if (!$result) {
die('Invalid query: ' . mysql_error());
示例7: closedir
return $exts;
}
// Closes directory
closedir($myDirectory);
// Counts elements in array
$indexCount = count($dirArray);
// Sorts files
sort($dirArray);
// Loops through the array of files
$count = 0;
for ($index = 0; $index < $indexCount; $index++) {
// Gets File Names
$name = $dirArray[$index];
$namehref = $dirArray[$index];
// Gets Extensions
$extn = findexts($dirArray[$index]);
// Gets file size
$size = number_format(filesize($dirArray[$index]));
// Gets Date Modified Data
$modtime = date("M j Y g:i A", filemtime($dirArray[$index]));
$timekey = date("YmdHis", filemtime($dirArray[$index]));
// Print
if (is_dir(".{$niindex}/{$namehref}") && $namehref != ".") {
print "<tr>\n <td><i class='fa fa-folder'></i></td>\n <td><a href='./{$namehref}'>{$namehref}</a></td>\n <td></td>\n <td></td>\n <td></td>\n </tr>";
}
if ($extn == "nii" || $extn == "gz") {
print "\n <script>filenames.push('{$namehref}')</script>\n <tr>\n <td><i class='icon-sagittal'></i></td>\n <td><a href='./{$namehref}'>{$name}</a></td>\n <td><a href='./{$namehref}'>{$modtime}</a></td>\n <td><button class='btn btn-default' onclick='changeImage(\"{$count}\")'>View</button></td>\n <td><a href='http://neurosynth.org/decode/?url={$base}{$niindex}{$namehref}' target='_blank'><button class='btn btn-default'>Decode</button></a></td>\n </tr>";
$count = $count + 1;
}
}
?>
示例8: while
$loai = "1";
while ($row = mysql_fetch_array($ress)) {
$loai = $row[0];
}
$a->setMA_FILE($num);
$a->setKICH_THUOC_FILE($fileSize);
$a->setMA_HOA_FILE($mahoafile);
$a->setMA_LOAI_CHIA_SE("ml02");
$a->setMA_LOAI_FILE($loai);
$a->setMA_THU_MUC($matm);
$a->setMAT_KHAU_CS_FILE("");
$a->setSO_LUOT_DOWN("0");
$a->setTEN_FILE($fileName);
$a->setTRANG_THAI("active");
$a->themfile();
// 0 for false... and 1 for true
if (!$fileTmpLoc) {
// if file not chosen
echo "ERROR: Please browse for a file before clicking the upload button.";
exit;
}
if (move_uploaded_file($fileTmpLoc, "file/{$num}." . findexts($fileName))) {
echo "complete";
} else {
echo "move_uploaded_file function failed";
}
?>
wserqwrqwrwqerqwe
132erq2
示例9: fwrite
fwrite($fh, "\n");
fwrite($fh, $str2);
fwrite($fh, "\n");
fclose($fh);
$upload_path = '../temp/';
// The place the files will be uploaded to (currently a 'files' directory).
$ran = "input_file.";
function findexts($filename)
{
$filename = strtolower($filename);
$exts = split("[/\\.]", $filename);
$n = count($exts) - 1;
$exts = $exts[$n];
return $exts;
}
$ext = findexts($_FILES['input_file']['name']);
if ($ext != "txt") {
die('The extension of the file should be .txt');
}
// Check if we can upload to the specified path, if not DIE and inform the user.
if (!is_writable($upload_path)) {
die('You cannot upload to the specified directory, please CHMOD it to 777.');
}
$upload_path = $upload_path . $ran . $ext;
if (move_uploaded_file($_FILES['input_file']['tmp_name'], $upload_path)) {
echo "The file has been uploaded as " . $ran . $ext;
} else {
echo "Sorry, there was a problem uploading your file.";
}
unset($output);
exec("/var/www/html/VirtualLabs/experiments/exp_2/c_files/load_inputs_expt_3_1 </var/www/html/VirtualLabs/experiments/exp_2/temp/tempFile", $output, $result);
示例10: dechex
$e[$i] = dechex($e[$i] <= 0 ? 0 : ($e[$i] >= 255 ? 255 : $e[$i]));
}
for ($i = 0; $i < 3; $i++) {
$out .= (strlen($e[$i]) < 2 ? '0' : '') . $e[$i];
}
$out = strtoupper($out);
} else {
$out = false;
}
return $out;
}
$file = filter_var($_GET['_img'], FILTER_VALIDATE_URL);
if (!$file) {
exit;
}
$ext = findexts($file);
if ($ext == 'jpg' || $ext == 'jpeg') {
$img = imagecreatefromjpeg($file);
} elseif ($ext == 'gif') {
$img = imagecreatefromgif($file);
} elseif ($ext == 'png') {
$img = imagecreatefrompng($file);
} else {
exit;
}
$max_width = 325;
$max_height = 300;
$colsize = 650 / 26;
$columns = 26;
$rows = 15;
$low_width = $max_width / $columns;
示例11: BLBlobs
$blBlobs = new BLBlobs();
include_once getcwd() . "/include/imagehandler.php";
$upload_name = "Filedata";
//image uploaden + naar tabel wegschrijven
if (!empty($_FILES[$upload_name])) {
if (findexts($_FILES[$upload_name]['name']) == "jpg" || findexts($_FILES[$upload_name]['name']) == "jpeg" || findexts($_FILES[$upload_name]['imagename']) == "gif" || findexts($_FILES[$upload_name]['name']) == "png") {
$file = $_POST["CARID"] . "_" . strtolower(str_replace(" ", "_", $_FILES[$upload_name]['name']));
$path = getcwd() . "/pictures/";
//large
$errorim = upload($_FILES[$upload_name]['tmp_name'], $path, $file, 1600, 1600);
chmod($path . $file, 0777);
//class
if ($errorim[0] == true) {
//Insert blob in table
$blobId = $blBlobs->uploadBlobs($path . $file);
$carpicture = new CarPicture(0, str_replace("." . findexts($file), "", $file), findexts($file), $_POST["CARID"], $blobId);
$carpicture->setId($blCarPicture->insertCarPicture($carpicture));
$car = $blCar->getCar($_POST["CARID"]);
//default
if ($car->getDefaultPictureId() == null) {
$car->setDefaultPictureId($carpicture->getId());
$blCar->updateCar($car);
}
//pictureorder
$max = $blPictureOrder->getMaxPictureOrderByCar($car->getId()) + 1;
$pictureorder = new PictureOrder(0, $max, $car->getId(), $carpicture->getId());
$blPictureOrder->insertPictureOrder($pictureorder);
//success
//HandleError('<span style="color:green">' . $file . ' saved!</span><br />');
$carpicturelist[] = $carpicture;
} else {
示例12: findexts
function findexts($filename)
{
return strtolower(pathinfo($filename, PATHINFO_EXTENSION));
}
$etape = 1;
$addimage = '';
if (!empty($_POST)) {
$etape = 3;
}
$errormessage = _tr('Wrong format');
if (isset($_FILES["file"])) {
if ($_FILES["file"]["size"] > 10000000) {
$errormessage = _tr('Image too Big');
}
$allowedExts = array("jpg", "jpeg", "gif", "png");
$extension = findexts($_FILES["file"]["name"]);
if (($_FILES["file"]["type"] == "image/gif" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/png" || $_FILES["file"]["type"] == "image/pjpeg" || $_FILES["file"]["type"] == "application/octet-stream") && $_FILES["file"]["size"] < 10000000 && in_array($extension, $allowedExts)) {
if ($_FILES["file"]["error"] > 0) {
echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
$errormessage = _tr('Bad picture') . ' ' . $_FILES["file"]["error"];
} else {
if (file_exists("../files/temp/" . $_FILES["file"]["name"])) {
echo $_FILES["file"]["name"] . " already exists. ";
$errormessage = $_FILES["file"]["name"] . ' ' . _tr('already exists');
} else {
move_uploaded_file($_FILES["file"]["tmp_name"], "../files/full/" . date("Ymd-His.") . $extension);
$filename = "../files/full/" . date("Ymd-His.") . $extension;
/*
$addimage = "upload/gallery/" . date("Ymd-His.").$extension;
$thumbimage600 = "upload/600/" . date("Ymd-His.").$extension;
$thumbimage300 = "upload/300/" . date("Ymd-His.").$extension;
示例13: krsort
}
}
krsort($files);
$dirArray = array_values($files);
//loop through the array of files
for ($index = 0; $index < count($dirArray); $index++) {
$file_name = $dirArray[$index];
$file_path = str_replace(" ", "%20", $save_dir . $dirArray[$index]);
$file_size = size_readable(filesize($save_dir . $dirArray[$index]));
$file_modtime = strftime('%c', filemtime($save_dir . $dirArray[$index]));
$file_new = $index === 0 && $action_save && $scanner_ok && time() - filemtime($save_dir . $dirArray[$index]) <= 60;
if (!$do_file_timezone) {
$file_modtime = str_replace(array(' CET', ' CEST'), '', $file_modtime);
}
//file type and category
$file_extention = findexts($dirArray[$index]);
$file_category = '';
switch ($file_extention) {
case "bmp":
$file_extention = $lang[$lang_id][47];
$file_category = "image";
break;
case "jpg":
case "jpeg":
$file_extention = $lang[$lang_id][44];
$file_category = "image";
break;
case "pdf":
$file_extention = $lang[$lang_id][43];
$file_category = "document";
break;
示例14: upload_files
function upload_files(&$resp)
{
$output_dir = codopm::$upload_path . 'client/uploads/';
$file_size = 0;
$valid_exts = codopm::$config['valid_exts'];
$file_size_limit = codopm::$config['per_filesize_limit'] * 1024;
//2 MB
$total_file_size_limit = codopm::$config['total_filesize_limit'] * 1024;
//10MB
$file_ext = explode(",", $valid_exts);
$file_names = array();
foreach ($_FILES as $file) {
$file_uploaded_ext = strtolower(findexts($file["name"]));
if (!in_array($file_uploaded_ext, $file_ext)) {
$resp->has_error = true;
$resp->msg = "file extension not supported";
} else {
if ($file["size"] > $file_size_limit) {
$resp->has_error = true;
$resp->msg = "file size cannot be greater than {$file_size_limit} KB";
} else {
if ($file["error"] > 0) {
$resp->has_error = true;
$resp->msg = "file could not be uploaded [" . $_FILES["myfile"]["error"] . "]";
} else {
if ($file["error"] == 0 && $file_size < $total_file_size_limit) {
$file_size += $file['size'];
$uname = time() . rand(22, 333) . "." . $file_uploaded_ext;
move_uploaded_file($file["tmp_name"], $output_dir . $uname);
$file_names[] = array("name" => strip_tags($file["name"]), "uname" => $uname);
} else {
$resp->has_error = true;
$resp->msg = "Total file size exceeds {$total_file_size_limit} KB";
}
}
}
}
}
return $file_names;
}
示例15: findexts
<?php
include '../_paths.php';
//$destination="Recordedfiles/".$_GET["filename"];
$source = $fmsRootPath . "userlist/" . $_GET["filename"];
//$destination="E:/dpk/Recordedfiles/".$_GET["filename"];
$teacher = $_GET["teachername"];
function findexts($filename)
{
$filename = strtolower($filename);
$exts = split("[/\\.]", $filename);
$n = count($exts) - 1;
$exts = $exts[$n];
return $exts;
}
$ext = findexts($_GET["filename"]);
$ran = date("m.d.y");
$ran3 = time();
$ran = $ran . "_" . $ran3;
$ran2 = $ran . ".";
$target = "Recordedfiles/";
$target = $target . $teacher . $ran2 . $ext;
echo "\n\n\n\n\n";
echo $ext;
echo "\n\n\n\n\n";
echo $target;
echo "\n\n\n\n\n";
//echo $ext;
echo "\n\n\n\n\n";
//if(rename($_GET["filename"], $target))
//{