本文整理汇总了PHP中delete_file函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_file函数的具体用法?PHP delete_file怎么用?PHP delete_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_files
function delete_files($rel_id)
{
global $database;
$this->check_level = array(9, 8);
if (isset($rel_id)) {
/** Do a permissions check */
if (isset($this->check_level) && in_session_or_cookies($this->check_level)) {
/**
* Get all the relevant file information using the id parameter
*/
$this->sql_id = $database->query('SELECT file_id FROM tbl_files_relations WHERE id="' . $rel_id . '"');
while ($this->data_file = mysql_fetch_array($this->sql_id)) {
$this->file_id = $this->data_file['file_id'];
}
$this->sql_url = $database->query('SELECT url FROM tbl_files WHERE id="' . $this->file_id . '"');
while ($this->data_file_2 = mysql_fetch_array($this->sql_url)) {
$this->file_url = $this->data_file_2['url'];
}
/** Delete the reference to the file on the database */
$this->sql = $database->query('DELETE FROM tbl_files WHERE id="' . $this->file_id . '"');
/**
* Use the id and uri information to delete the file.
*
* @see delete_file
*/
delete_file(UPLOADED_FILES_FOLDER . $this->file_url);
return $this->file_url;
}
}
}
示例2: delete_picture_more
function delete_picture_more($type, $record_id, $multi=0, $path="../../"){
global $lang_id;
$fs_table = $type . "_pictures";
$prefix = "";
switch($type){
case "tour": $prefix = "tp"; break;
}
$id_field = ($multi != 1) ? $prefix . "_id" : $prefix . "_" . $type . "_id";
$fs_fieldupload = $prefix . "_picture";
$fs_filepath_fullsize= $path . $type . "_pictures_more/fullsize/";
$fs_filepath_small = $path . $type . "_pictures_more/small/";
$fs_filepath_normal = $path . $type . "_pictures_more/normal/";
$db_check = new db_query("SELECT " . $fs_fieldupload . " FROM " . $fs_table . " WHERE " . $id_field . " = " . $record_id . " AND lang_id = " . $lang_id);
while($check = mysql_fetch_array($db_check->result)){
if($check[$fs_fieldupload] != ""){
delete_file($fs_filepath_fullsize, $check[$fs_fieldupload]);
delete_file($fs_filepath_small, $check[$fs_fieldupload]);
delete_file($fs_filepath_normal, $check[$fs_fieldupload]);
}
$db_execute = new db_execute("DELETE FROM " . $fs_table . " WHERE " . $id_field . " = " . $record_id);
unset($db_execute);
}
unset($db_check);
}
示例3: delete_files
function delete_files($rel_id)
{
$this->check_level = array(9, 8);
if (isset($rel_id)) {
/** Do a permissions check */
if (isset($this->check_level) && in_session_or_cookies($this->check_level)) {
$this->file_id = $rel_id;
$this->sql = $this->dbh->prepare("SELECT url FROM " . TABLE_FILES . " WHERE id = :file_id");
$this->sql->bindParam(':file_id', $this->file_id, PDO::PARAM_INT);
$this->sql->execute();
$this->sql->setFetchMode(PDO::FETCH_ASSOC);
while ($this->row = $this->sql->fetch()) {
$this->file_url = $this->row['url'];
}
/** Delete the reference to the file on the database */
$this->sql = $this->dbh->prepare("DELETE FROM " . TABLE_FILES . " WHERE id = :file_id");
$this->sql->bindParam(':file_id', $this->file_id, PDO::PARAM_INT);
$this->sql->execute();
/**
* Use the id and uri information to delete the file.
*
* @see delete_file
*/
delete_file(UPLOADED_FILES_FOLDER . $this->file_url);
return $this->file_url;
}
}
}
示例4: cleartemptrans
function cleartemptrans()
{
$db = tDataConnect();
if ($_SESSION["msg"] == 2) {
$_SESSION["msg"] = 99;
sql_query("update localtemptrans set trans_status = 'X'", $db);
}
if ($_SESSION["DBMS"] == "mssql") {
sql_query("exec clearTempTables", $db);
} else {
moveTempData();
truncateTempTables();
}
sql_close($db);
testremote();
loadglobalvalues();
$_SESSION["transno"] = $_SESSION["transno"] + 1;
setglobalvalue("TransNo", $_SESSION["transno"]);
if ($_SESSION["TaxExempt"] != 0) {
$_SESSION["TaxExempt"] = 0;
setglobalvalue("TaxExempt", 0);
}
memberReset();
transReset();
printReset();
getsubtotals();
delete_file(remote_oux());
delete_file(local_inx());
return 1;
}
示例5: store_file
function store_file($challenge_id, $file)
{
if ($file['error']) {
message_error('Could not upload file: ' . file_upload_error_description($file['error']));
}
if ($file['size'] > max_file_upload_size()) {
message_error('File too large.');
}
$file_id = db_insert('files', array('added' => time(), 'added_by' => $_SESSION['id'], 'title' => $file['name'], 'size' => $file['size'], 'challenge' => $challenge_id));
if (file_exists(CONFIG_PATH_FILE_UPLOAD . $file_id)) {
message_error('File already existed! This should never happen!');
}
// do we put the file on AWS S3?
if (CONFIG_AWS_S3_KEY_ID && CONFIG_AWS_S3_SECRET && CONFIG_AWS_S3_BUCKET) {
try {
// Instantiate the S3 client with your AWS credentials
$client = S3Client::factory(array('key' => CONFIG_AWS_S3_KEY_ID, 'secret' => CONFIG_AWS_S3_SECRET));
$file_key = '/challenges/' . $file_id;
// Upload an object by streaming the contents of a file
$result = $client->putObject(array('Bucket' => CONFIG_AWS_S3_BUCKET, 'Key' => $file_key, 'SourceFile' => $file['tmp_name']));
// We can poll the object until it is accessible
$client->waitUntil('ObjectExists', array('Bucket' => CONFIG_AWS_S3_BUCKET, 'Key' => $file_key));
} catch (Exception $e) {
message_error('Caught exception uploading file to S3: ' . $e->getMessage());
}
} else {
move_uploaded_file($file['tmp_name'], CONFIG_PATH_FILE_UPLOAD . $file_id);
if (!file_exists(CONFIG_PATH_FILE_UPLOAD . $file_id)) {
delete_file($file_id);
message_error('File upload failed!');
}
}
}
示例6: deleteOldImages
/**
* @param User $model
*
* @return bool|null
*/
private function deleteOldImages(User $model)
{
$image = $model->avatar;
if (is_string($image)) {
return true;
}
return file_exists_on_server($image) ? delete_file($image) : true;
}
示例7: deleteProductImages
/**
* @param Product $model
*
* @return bool|null
*/
private function deleteProductImages(Product $model)
{
$images = [$model->image, $model->image_large];
$result = null;
foreach ($images as $image) {
if (file_exists_on_server($image)) {
$result = delete_file($image);
}
}
return $result;
}
示例8: delete_cell
function delete_cell($name)
{
$results = array();
$name = strtolower($name);
$class_suffix = '_cell';
$controller_path = FCPATH . 'application/cell/controllers/' . $name . $class_suffix . EXT;
$views_path = FCPATH . 'application/cell/views/' . $name . $class_suffix . '/';
directory_delete($views_path, true, $results);
if (delete_file($controller_path)) {
array_push($results, $controller_path);
}
return $results;
}
示例9: Del_file
function Del_file($id_file, $user_id, $admin = false)
{
global $Sql;
if ($admin) {
$name = $Sql->query("SELECT path FROM " . DB_TABLE_UPLOAD . " WHERE id = '" . $id_file . "'", __LINE__, __FILE__);
$Sql->query_inject("DELETE FROM " . DB_TABLE_UPLOAD . " WHERE id = '" . $id_file . "'", __LINE__, __FILE__);
delete_file(PATH_TO_ROOT . '/upload/' . $name);
return '';
} else {
$check_id_auth = $Sql->query("SELECT user_id FROM " . DB_TABLE_UPLOAD . " WHERE id = '" . $id_file . "'", __LINE__, __FILE__);
if ($check_id_auth == $user_id) {
$name = $Sql->query("SELECT path FROM " . DB_TABLE_UPLOAD . " WHERE id = '" . $id_file . "'", __LINE__, __FILE__);
$Sql->query_inject("DELETE FROM " . DB_TABLE_UPLOAD . " WHERE id = '" . $id_file . "'", __LINE__, __FILE__);
delete_file(PATH_TO_ROOT . '/upload/' . $name);
return '';
}
return 'e_auth';
}
}
示例10: check_image
function check_image($path, $filename){
$sExtension = getExtension($filename);
//Check image file type extensiton
$checkImg = true;
switch($sExtension){
case "gif":
$checkImg = @imagecreatefromgif($path . $filename);
break;
case $sExtension == "jpg" || $sExtension == "jpe" || $sExtension == "jpeg":
$checkImg = @imagecreatefromjpeg($path . $filename);
break;
case "png":
$checkImg = @imagecreatefrompng($path . $filename);
break;
}
if(!$checkImg){
delete_file($path, $filename);
return 0;
}
return 1;
}
示例11: directory_delete
function directory_delete($dir, $is_root = true, &$path = null)
{
$dir = rtrim($dir, DIRECTORY_SEPARATOR);
if (!($current_dir = @opendir($dir))) {
return false;
}
while (false !== ($filename = @readdir($current_dir))) {
if ($filename != '.' and $filename != '..') {
if (is_dir($dir . DIRECTORY_SEPARATOR . $filename)) {
if (substr($filename, 0, 1) != '.') {
directory_delete($dir . DIRECTORY_SEPARATOR . $filename, true, $path);
}
} else {
if (delete_file($p = $dir . DIRECTORY_SEPARATOR . $filename) && $path !== null) {
array_push($path, $p);
}
}
}
}
@closedir($current_dir);
return $is_root ? @rmdir($dir) : true;
}
示例12: delete_file
/**
*Filie:File_DIR_Opration 文件目录删除方法
* 功能:一个项目中所有的.svn目录
* 可以根据需要扩展
*@param $path 文件目录
* return true
*/
function delete_file($path)
{
if (!is_writable($path)) {
if (!chmod($path, 0777)) {
echo '文件操作失败!~';
exit;
}
}
$dh = opendir($path);
while (($file = readdir($dh)) !== false) {
if ($file != "." && $file != "..") {
if (is_dir($path . '/' . $file)) {
if ($file == '.svn') {
full_rmdir($path . '/' . $file);
continue;
}
delete_file($path . '/' . $file);
}
}
}
return false;
}
示例13: redirect
$Cache->Generate_module_file('gallery');
}
}
}
}
redirect(HOST . DIR . '/gallery/admin_gallery_add.php?add=' . $idpic);
} elseif (!empty($_POST['valid']) && !empty($nbr_pics_post)) {
for ($i = 1; $i <= $nbr_pics_post; $i++) {
$activ = !empty($_POST[$i . 'activ']) ? trim($_POST[$i . 'activ']) : '';
$uniq = !empty($_POST[$i . 'uniq']) ? strprotect($_POST[$i . 'uniq']) : '';
if ($activ && !empty($uniq)) {
$name = !empty($_POST[$i . 'name']) ? strprotect($_POST[$i . 'name']) : 0;
$cat = !empty($_POST[$i . 'cat']) ? numeric($_POST[$i . 'cat']) : 0;
$del = !empty($_POST[$i . 'del']) ? numeric($_POST[$i . 'del']) : 0;
if ($del) {
delete_file('pics/' . $uniq);
} else {
$Gallery->Add_pics($cat, $name, $uniq, $User->get_attribute('user_id'));
}
}
}
$Cache->Generate_module_file('gallery');
redirect(HOST . DIR . '/gallery/admin_gallery_add.php');
} else {
$Template->set_filenames(array('admin_gallery_add' => 'gallery/admin_gallery_add.tpl'));
$get_error = !empty($_GET['error']) ? trim($_GET['error']) : '';
$array_error = array('e_upload_invalid_format', 'e_upload_max_weight', 'e_upload_max_dimension', 'e_upload_error', 'e_upload_failed_unwritable', 'e_upload_already_exist', 'e_unlink_disabled', 'e_unsupported_format', 'e_unabled_create_pics', 'e_error_resize', 'e_no_graphic_support', 'e_unabled_incrust_logo', 'delete_thumbnails');
if (in_array($get_error, $array_error)) {
$Errorh->handler($LANG[$get_error], E_USER_WARNING);
}
$cat_list = '<option value="0" selected="selected">' . $LANG['root'] . '</option>';
示例14: fgets
exit;
}
echo "-- fgets() with default length, file pointer at 0 --\n";
// get the file pointer to beginning of the file
rewind($file_handle);
var_dump(ftell($file_handle));
var_dump(fgets($file_handle));
// with default length
var_dump(ftell($file_handle));
// ensure the file pointer position
var_dump(feof($file_handle));
// enusre if eof set
echo "-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 --\n";
// get the file pointer to beginning of the file
rewind($file_handle);
var_dump(ftell($file_handle));
var_dump(fgets($file_handle, 23));
// expected: 22 chars
var_dump(ftell($file_handle));
// ensure the file pointer position
var_dump(feof($file_handle));
// enusre if eof set
//close file
fclose($file_handle);
// delete file
delete_file($filename);
}
// file_content_type loop
}
// file_mode loop
echo "Done\n";
示例15: login_cookie_check
login_cookie_check();
// check for csrf
if (!defined('GSNOCSRF') || GSNOCSRF == FALSE) {
$nonce = $_GET['nonce'];
if (!check_nonce($nonce, "delete", "deletefile.php")) {
die("CSRF detected!");
}
}
// are we deleting pages?
if (isset($_GET['id'])) {
$id = $_GET['id'];
if ($id == 'index') {
redirect('pages.php?upd=edit-error&type=' . urlencode(i18n_r('HOMEPAGE_DELETE_ERROR')));
} else {
updateSlugs($id);
$status = delete_file($id);
generate_sitemap();
exec_action('page-delete');
redirect("pages.php?upd=edit-" . $status . "&id=" . $id . "&type=delete");
}
}
// are we deleting archives?
if (isset($_GET['zip'])) {
$zip = $_GET['zip'];
$status = delete_zip($zip);
redirect("archive.php?upd=del-" . $status . "&id=" . $zip);
}
// are we deleting uploads?
if (isset($_GET['file'])) {
$path = isset($_GET['path']) ? $_GET['path'] : "";
$file = $_GET['file'];