upload() public method

Upload a file
public upload ( $file, $filename = null ) : string
return string
コード例 #1
0
 public function run()
 {
     Yii::import('ext.editMe.vendors.kcfinder.core.*');
     Yii::import('ext.editMe.vendors.kcfinder.lib.*');
     $uploader = new uploader();
     $uploader->upload();
 }
コード例 #2
0
ファイル: modproductos.php プロジェクト: klich3/gPOS
function UploadFoto()
{
    require "modulos/fileupload/fileupload-class.php";
    $full = "productos_img/";
    //$mini = "productos_img/";
    $my_uploader = new uploader();
    $success = $my_uploader->upload("file", "", ".jpg");
    if ($success) {
        $modo = 2;
        $success = $my_uploader->save_file($full, $modo);
        if (!$success) {
            return false;
        }
        return $my_uploader->file['name'];
    }
    return false;
}
コード例 #3
0
    $chars = numbers($config['maxaboutlength']);
    $bbcode = initBBCodes();
    $inner['bbhtml'] = $bbcode->getbbhtml();
    $inner['smileys'] = $bbcode->getsmileyhtml($config['smileysperrow']);
    $mymodules->load('editprofile_about_top');
    echo $tpl->parse("editprofile/about");
} elseif ($_GET['action'] == "pic2") {
    $pic = $gpc->get('pic', none);
    if ($my->p['usepic'] == 0) {
        errorLogin($lang->phrase('not_allowed'), "editprofile.php");
    } elseif (isset($_FILES) && is_array($_FILES['upload']) && !empty($_FILES['upload']['name'])) {
        require "classes/class.upload.php";
        $my_uploader = new uploader();
        $my_uploader->max_filesize($config['avfilesize']);
        $my_uploader->max_image_size($config['avwidth'], $config['avheight']);
        if ($my_uploader->upload('upload', explode('|', $config['avfiletypes']))) {
            $my_uploader->save_file('uploads/pics/', '2');
        }
        if ($my_uploader->return_error()) {
            error($my_uploader->return_error(), 'editprofile.php?action=pic');
        } else {
            if (file_exists($my->pic)) {
                @unlink($my->pic);
            }
            $ext = $my_uploader->rename_file('uploads/pics/', $my_uploader->file['name'], $my->id);
        }
        $my->pic = 'uploads/pics/' . $my->id . $ext;
    } elseif (!empty($pic) && preg_match('/^(http:\\/\\/|www.)([\\wהצ�ִײ�@\\-_\\.]+)\\:?([0-9]*)\\/(.*)$/', $pic, $url_ary)) {
        $my->pic = checkRemotePic($pic, $url_ary, $my->id);
    } else {
        removeOldImages('uploads/pics/', $my->id);
コード例 #4
0
 $insertuploads = array();
 $inserterrors = array();
 require "classes/class.upload.php";
 $success = 0;
 for ($i = 0; $i < $ups; $i++) {
     if (empty($_FILES['upload_' . $i]['name'])) {
         continue;
     }
     $my_uploader = new uploader();
     $my_uploader->max_filesize($filesize);
     $my_uploader->file_types($filetypes);
     $my_uploader->set_path($dir . DIRECTORY_SEPARATOR);
     if (isset($imgwidth) && isset($imgheight)) {
         $my_uploader->max_image_size($imgwidth, $imgheight);
     }
     if ($my_uploader->upload('upload_' . $i)) {
         $my_uploader->save_file();
     }
     if ($my_uploader->upload_failed()) {
         array_push($inserterrors, $my_uploader->get_error());
     }
     $file = $dir . DIRECTORY_SEPARATOR . $my_uploader->fileinfo('filename');
     if (!file_exists($file)) {
         $inserterrors[] = $lang->phrase('admin_explorer_file_does_not_exist');
     } else {
         $success++;
     }
 }
 echo head();
 if ($success == 0) {
     $inserterrors[] = $lang->phrase('admin_explorer_no_file_successfully_uploaded');
コード例 #5
0
<?php

include "../../connection/phpmysqlconnect.php";
include "../../lib/CRUD_lib.php";
include "../../lib/miss_lib.php";
// post data
// File processing
$ext_array = array("jpeg", "jpg", "png");
$mime_array = array("image/jpeg", "image/jpg", "image/png");
$location = "../../media/featured_product/";
$image = new uploader();
if ($image->upload_validate($_FILES['files'], $ext_array, $mime_array) == true) {
    $image_name = $image->upload($_FILES['files'], $location);
    $column = array('logo');
    $value = array($image_name);
    $insert = new crud($conn, 'featured-product', $column, $value);
    $insert->insert();
    $move = new alert_redirect();
    $move->moveWithAlert('Logo has been added', '../../pages/distributor-logo.php');
}
$move->moveWithAlert('Error in uploading image', '../../pages/distributor-logo.php');
コード例 #6
0
// included files
include "../../../connection/phpmysqlconnect.php";
include "../../../library/CRUD_lib.php";
include "../../../library/miss_lib.php";
// post data
$user_id = $_POST['user_id'];
$month = $_POST['month'];
$year = $_POST['year'];
$modifier = $_SESSION["user"];
// File processing
$ext_array = array("xls", "csv", "xlsx");
$mime_array = array("application/vnd.ms-excel", "text/csv", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
$location = "../../media/performance-sheet/";
$file = new uploader();
if (is_uploaded_file($_FILES['file']['tmp_name'])) {
    if ($file->upload_validate($_FILES['file'], $ext_array, $mime_array) == true) {
        $file_name = $file->upload($_FILES['file'], $location);
        // insertion
        $column = array('performance_sheet', 'user_id', 'month', 'year', 'uploaded_by', 'modified_by');
        $value = array("{$file_name}", "{$user_id}", "{$month}", "{$year}", "{$modifier}", "{$modifier}");
        $insert = new crud($conn, 'employee_performance', $column, $value);
        $insert->insert();
        $move = new alert_redirect();
        $move->moveWithAlert('New Performance Sheet has been added', '../pages/addperformance.php');
    } else {
        $move = new alert_redirect();
        $move->moveWithAlert('File Extension not valid', '../pages/addperformance.php');
    }
    $move = new alert_redirect();
    $move->moveWithAlert('File not uploaded', '../pages/addperformance.php');
}
コード例 #7
0
<?php

chdir('../../');
include 'pv_core.php';
CheckLogin();
LoadUserlanguage();
if (isset($_FILES) && count($_FILES) > 0) {
    $path = '../' . $Cfg['upload_path'];
    require_once 'includes/fileupload-class.php';
    $lang = str_replace("_utf8", "", $Users[$Pivot_Vars['user']]['language']);
    $my_uploader = new uploader($lang);
    // OPTIONAL: set the max filesize of uploadable files in bytes
    $my_uploader->max_filesize($Cfg['max_filesize']);
    // UPLOAD the file
    if ($my_uploader->upload('userfile', $Cfg['upload_accept'], '')) {
        $success = $my_uploader->save_file($path, $Cfg['upload_save_mode'], 1);
    }
}
if (isset($_GET['f_target'])) {
    $target = $_GET['f_target'];
} else {
    $target = $_POST['f_target'];
}
if (isset($_GET['f_text'])) {
    $text = urldecode($_GET['f_text']);
} else {
    $text = $_POST['f_text'];
}
if (!isset($Users[$Pivot_Vars['user']]['wysiwyg'])) {
    $useWysiwyg = $Cfg['wysiwyg_editor'] == 1 ? TRUE : FALSE;
} else {
コード例 #8
0
ファイル: db.php プロジェクト: BackupTheBerlios/viscacha-svn
} elseif ($job == 'query2') {
    echo head();
    $type = $gpc->get('type', int);
    if ($type == 1) {
        $filetypes = array('zip', 'sql');
        $dir = 'temp/';
        $inserterrors = array();
        require "classes/class.upload.php";
        if (empty($_FILES['upload']['name'])) {
            $inserterrors[] = 'No file specified.';
        }
        $my_uploader = new uploader();
        $my_uploader->max_filesize(ini_maxupload());
        $my_uploader->file_types($filetypes);
        $my_uploader->set_path($dir);
        if ($my_uploader->upload('upload')) {
            if ($my_uploader->save_file()) {
                $file = $dir . $my_uploader->fileinfo('filename');
                if (!file_exists($file)) {
                    $inserterrors[] = 'File (' . $file . ') does not exist.';
                }
            }
        }
        if ($my_uploader->upload_failed()) {
            array_push($inserterrors, $my_uploader->get_error());
        }
        if (count($inserterrors) > 0) {
            error('admin.php?action=db&job=query', $inserterrors);
        } else {
            $ext = get_extension($file);
            if (($ext == 'zip' || $ext == 'sql') && file_exists($file)) {
コード例 #9
0
         }
         $db->query('DELETE FROM ' . $db->pre . 'uploads WHERE mid = "' . $upinfo['name'] . '" AND id IN (' . implode(',', $ids) . ')', __LINE__, __FILE__);
         viscacha_header('Location: attachments.php?type=' . $_GET['type'] . '&id=' . $_GET['id'] . SID2URL_JS_x);
     }
 } else {
     $insertuploads = array();
     $inserterrors = array();
     require "classes/class.upload.php";
     for ($i = 0; $i < $config['tpcmaxuploads']; $i++) {
         if (empty($_FILES['upload_' . $i]['name'])) {
             continue;
         }
         $my_uploader = new uploader();
         $my_uploader->max_filesize($config['tpcfilesize']);
         $my_uploader->max_image_size($config['tpcwidth'], $config['tpcheight']);
         if ($my_uploader->upload('upload_' . $i, explode('|', $config['tpcfiletypes']), 1)) {
             $my_uploader->save_file('uploads/topics/', '2');
         }
         if ($my_uploader->return_error()) {
             array_push($inserterrors, $my_uploader->return_error());
         }
         array_push($insertuploads, $my_uploader->file['name']);
     }
     if (count($inserterrors) > 0) {
         error($inserterrors, 'attachments.php?type=' . $_GET['type'] . '&amp;id=' . $_GET['id'] . SID2URL_x);
     }
     if ($_GET['type'] == 'edit' && ($my->mp[0] == 1 || $upinfo['name'] == $my->id)) {
         $upper = $upinfo['name'];
         $tid = $upinfo['id'];
     } else {
         $upper = $my->id;
コード例 #10
0
ファイル: upload.php プロジェクト: alexpagnoni/fileuploadlib
                $line = fgets($userfile, 255);
                switch ($mode) {
                    case 1:
                        echo $line;
                        break;
                    case 2:
                        echo nl2br(ereg_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", htmlentities($line)));
                        break;
                }
            }
        }
    }
}
$upload = new uploader();
$upload->max_filesize(30000);
if ($upload->upload("{$FILENAME}", "{$ACCEPT}", "{$EXTENSION}")) {
    while (list($key, $var) = each($upload->file)) {
        echo $key . " = " . $var . "<br>";
    }
    if ($upload->save_file("{$PATH}", $SAVE_MODE)) {
        print "<p>Saved as: " . $upload->new_file . "<p>";
        print_file($upload->new_file, $upload->file["type"], 2);
    }
}
if ($upload->errors) {
    while (list($key, $var) = each($upload->errors)) {
        echo "<p>" . $var . "<br>";
    }
}
if ($NEW_NAME) {
    print "<p>Name of image save: <b>{$NEW_NAME}</b></p>";
コード例 #11
0
     }
 }
 $insertuploads = array();
 $inserterrors = array();
 require "classes/class.upload.php";
 $success = 0;
 for ($i = 0; $i < $ups; $i++) {
     if (empty($_FILES['upload_' . $i]['name'])) {
         continue;
     }
     $my_uploader = new uploader();
     $my_uploader->max_filesize($filesize);
     if (isset($imgwidth) && isset($imgheight)) {
         $my_uploader->max_image_size($imgwidth, $imgheight);
     }
     if ($my_uploader->upload('upload_' . $i, $filetypes)) {
         $my_uploader->save_file($dir, 2);
         $errstr = $my_uploader->return_error();
         if (!empty($errstr)) {
             array_push($inserterrors, $my_uploader->return_error());
         }
     } else {
         array_push($inserterrors, $my_uploader->return_error());
     }
     $file = $dir . DIRECTORY_SEPARATOR . $my_uploader->file['name'];
     if (!file_exists($file)) {
         $inserterrors[] = 'File (' . $file . ') does not exist.';
     } else {
         $success++;
     }
 }
コード例 #12
0
// 저장 옵션:
// 1 = 같은 이름의 파일이 존재 하면 덮어 씁니다.
// 2 = 같은 이름의 파일이 존재할 경우, 파일 이름 뒤에 _copy,jpg, _copy1.jpg ... 식으로 이름을 붙입니다.
// 3 = 같은 이름의 파일이 존재할 경우, 업로드하지 않습니다.
//
define('SAVE_OPTION', 2);
if ($_REQUEST['do'] == "submit") {
    require_once "imageupload-class.php";
    $attach = new uploader();
    //////////////////////////////////////////////////////////////////////////
    // 옵션:
    //
    // $attach->max_filesize(102400);        // 이미지 업로드 최대 크기
    // $attach->max_image_size(1024, 1024);  // 이미지 가로, 세로 최대 픽셀 크기
    $attach->max_image_size(8096, 8096);
    $success = $attach->upload("AttachFile", ALLOW_FORMAT, "");
    if ($success) {
        $success = $attach->save_file(SAVE_AS_DIRECTORY, SAVE_OPTION);
        $filename = SAVE_AS_URL . $attach->file['name'];
        echo '<script type="text/javascript">';
        echo 'var obj = parent.window.insert_form;';
        echo 'obj.attachSuccess(\'' . $filename . '\');';
        echo '</script>';
    } else {
        if ($attach->errors) {
            $msg = '';
            while (list($k, $v) = each($attach->errors)) {
                $msg .= $v;
            }
            echo '<script type="text/javascript">';
            echo 'alert(\'' . $msg . '\');';
コード例 #13
0
ファイル: import_bans.php プロジェクト: rodoabad/amxx-bans
                    //print_r($import_info);
                }
            }
            $var = "";
        }
        $now = date("U");
        $add_log = mysql_query("INSERT INTO amx_logs (timestamp, ip, username, action, remarks) VALUES ('{$now}', '" . $_SERVER['REMOTE_ADDR'] . "', '" . $_SESSION['uid'] . "', 'import ban', 'imported bans: {$j}')") or die(mysql_error());
        return $import_array;
    }
    if (isset($_POST['en'])) {
        $my_uploader = new uploader($_POST['en']);
    } else {
        $my_uploader = new uploader("en");
    }
    $my_uploader->max_filesize(45000);
    if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) {
        $my_uploader->save_file($path, $mode);
    }
    if ($my_uploader->error) {
        //echo $my_uploader->error . "<br><br>\n";
    } else {
        $import_array = ban_file($my_uploader->file['name']);
    }
}
if (isset($acceptable_file_types) && trim($acceptable_file_types)) {
    $submit = "This form only accepts <b>" . str_replace("|", " or ", $acceptable_file_types) . "</b> files &nbsp;&nbsp;<input type='submit' name='importit' value='" . lang("_IMPORT") . "' style='font-family: verdana, tahoma, arial; font-size: 10px;'>";
} else {
    $submit = "No acceptable filetypes set.&nbsp;&nbsp;<input type='submit' name='importit' value='" . lang("_IMPORT") . "' style='font-family: verdana, tahoma, arial; font-size: 10px;' disabled>";
}
/****************************************************************
* Template parsing
コード例 #14
0
ファイル: pv_core.php プロジェクト: wborbajr/TecnodataApp
/**
 * Upload a file
 *
 */
function uploadfile()
{
    global $Cfg, $Paths, $Users, $Pivot_Vars, $qual, $local;
    MinLevel(2);
    include_once 'includes/fileupload-class.php';
    $lang = str_replace("_utf8", "", $Users[$Pivot_Vars['user']]['language']);
    $my_uploader = new uploader($lang);
    // OPTIONAL: set the max filesize of uploadable files in bytes
    $my_uploader->max_filesize($Cfg['max_filesize']);
    // UPLOAD the file
    if ($my_uploader->upload('userfile', $Cfg['upload_accept'], $Cfg['upload_extension'])) {
        debug($my_uploader->file['name']);
        $success = $my_uploader->save_file($Paths['upload_path'], $Cfg['upload_save_mode'], 1);
    }
    if ($success) {
        error_reporting(E_ALL);
        include_once "modules/module_imagefunctions.php";
        PageHeader(lang('userbar', 'main'), 1);
        PageAnkeiler(lang('userbar', 'files') . ' &raquo; ' . lang('userbar', 'uploaded_success'));
        printf('<script type="text/javascript">function pop(a){
			window.open("modules/module_image.php?image="+a,"",
				"toolbar=no,resizable=yes,scrollbars=yes,width=940,height=570");
			self.location="index.php?menu=files";}
                        </script>');
        echo '<tr><td align="center" colspan="2">';
        $fullentry = $Paths['upload_url'] . $my_uploader->file['name'];
        echo '<img src="' . $fullentry . '" border="0" alt="new image">';
        echo '</td></tr><tr><td align="right" width="48%"><br /><br />';
        if (auto_thumbnail($my_uploader->file['name'])) {
            echo "<p><b>Thumbnail:</b><br>";
            $thumbfilename = $Paths['upload_url'] . make_thumbname(basename($my_uploader->file['name']));
            printf('<p><img src="%s" />', $thumbfilename);
            printf('<p><a href="javascript:pop(\'%s\')">' . lang('upload', 'edit_thumbnail') . '</a></td>', $my_uploader->file['name']);
        } else {
            printf('<p><a href="javascript:pop(\'%s\');">' . lang('upload', 'create_thumb') . '</a></td>', $my_uploader->file['name']);
        }
        GenSetting('', lang('upload', 'thisfile'), '', 8, '', 6);
        StartForm('file_upload', 0, 'enctype="multipart/form-data"');
        printf('<input name="%s" type="file"  class="input"><br />', $Cfg['upload_file_name']);
        printf('<input type="submit" value="%s" class="button" /></form>', lang('upload', 'button'));
        PageFooter();
    } else {
        if ($my_uploader->errors) {
            files_main($my_uploader->errors);
        }
    }
}
コード例 #15
0
        }
        $filesystem->file_put_contents('data/feedcreator.inc.php', implode("\n", $n));
    }
    viscacha_header('Location: admin.php?action=misc&job=feedcreator');
} elseif ($job == 'feedcreator_add') {
    echo head();
    $name = $gpc->get('name', str);
    $class = $gpc->get('class', str);
    $active = $gpc->get('active', str);
    $dl = $gpc->get('dl', str);
    $dir = realpath('./classes/feedcreator/');
    $inserterrors = array();
    require "classes/class.upload.php";
    $my_uploader = new uploader();
    $my_uploader->max_filesize(200 * 1024);
    if ($my_uploader->upload('upload', array('.php'))) {
        if (strlen($my_uploader->return_error()) > 0) {
            array_push($inserterrors, $my_uploader->return_error());
        }
        $my_uploader->save_file($dir, 2);
        $file = $my_uploader->file['name'];
    } else {
        if (strlen($my_uploader->return_error()) > 0) {
            array_push($inserterrors, $my_uploader->return_error());
        } else {
            if (count($inserterrors) == 0) {
                array_push($inserterrors, 'An unexpected error occurred');
            }
        }
    }
    if (count($inserterrors) > 0) {
コード例 #16
0
<?php

chdir('../../');
include 'pv_core.php';
CheckLogin();
LoadUserlanguage();
if (isset($_FILES) && count($_FILES) > 0) {
    $path = '../' . $Cfg['upload_path'];
    require_once 'includes/fileupload-class.php';
    $lang = str_replace("_utf8", "", $Users[$Pivot_Vars['user']]['language']);
    $my_uploader = new uploader($lang);
    // OPTIONAL: set the max filesize of uploadable files in bytes
    $my_uploader->max_filesize($Cfg['max_filesize']);
    // UPLOAD the file
    if ($my_uploader->upload('userfile', $Cfg['upload_accept'], $Cfg['upload_extension'])) {
        $success = $my_uploader->save_file($path, $Cfg['upload_save_mode'], 1);
    }
}
if (isset($_GET['f_target'])) {
    $target = $_GET['f_target'];
} else {
    $target = $_POST['f_target'];
}
if (isset($_GET['f_text'])) {
    $text = urldecode($_GET['f_text']);
} else {
    $text = $_POST['f_text'];
}
if (!isset($Users[$Pivot_Vars['user']]['wysiwyg'])) {
    $useWysiwyg = $Cfg['wysiwyg_editor'] == 1 ? TRUE : FALSE;
} else {
コード例 #17
0
	<?php 
    echo foot();
} elseif ($job == 'import2') {
    $overwrite = $gpc->get('overwrite', int);
    $server = $gpc->get('server', none);
    $del = $gpc->get('delete', int);
    $inserterrors = array();
    if (!empty($_FILES['upload']['name'])) {
        $filesize = 1024 * 1024;
        $filetypes = array('.zip');
        $dir = realpath('temp/');
        $insertuploads = array();
        require "classes/class.upload.php";
        $my_uploader = new uploader();
        $my_uploader->max_filesize($filesize);
        if ($my_uploader->upload('upload', $filetypes)) {
            $my_uploader->save_file($dir, 2);
            if ($my_uploader->return_error()) {
                array_push($inserterrors, $my_uploader->return_error());
            }
        } else {
            array_push($inserterrors, $my_uploader->return_error());
        }
        $file = $dir . '/' . $my_uploader->file['name'];
        if (!file_exists($file)) {
            $inserterrors[] = 'File (' . $file . ') does not exist.';
        }
    } elseif (file_exists($server)) {
        $ext = get_extension($server, true);
        if ($ext == 'zip') {
            $file = $server;
コード例 #18
0
ファイル: upload.php プロジェクト: radist/modx.evo.custom
<?php

/** This file is part of KCFinder project
 *
 *      @desc Upload calling script
 *   @package KCFinder
 *   @version 2.51
 *    @author Pavel Tzonkov <*****@*****.**>
 * @copyright 2010, 2011 KCFinder Project
 *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
 *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
 *      @link http://kcfinder.sunhater.com
 */
require "core/autoload.php";
$uploader = new uploader($modx);
$uploader->upload();
コード例 #19
0
 $insertuploads = array();
 $inserterrors = array();
 require "classes/class.upload.php";
 ($code = $plugins->load('attachments_upload_save_add_start')) ? eval($code) : null;
 for ($i = 0; $i < $config['tpcmaxuploads']; $i++) {
     $field = "upload_{$i}";
     if (empty($_FILES[$field]['name'])) {
         continue;
     }
     $my_uploader = new uploader();
     $my_uploader->max_filesize($config['tpcfilesize']);
     $my_uploader->max_image_size($config['tpcwidth'], $config['tpcheight']);
     $my_uploader->file_types(explode(',', $config['tpcfiletypes']));
     $my_uploader->set_path('uploads/topics/');
     ($code = $plugins->load('attachments_upload_add_prepare')) ? eval($code) : null;
     if ($my_uploader->upload($field)) {
         if ($my_uploader->save_file()) {
             array_push($insertuploads, array('file' => $my_uploader->fileinfo('name'), 'source' => $my_uploader->fileinfo('filename')));
         }
     }
     if ($my_uploader->upload_failed()) {
         array_push($inserterrors, $my_uploader->get_error());
     }
 }
 if ($_GET['type'] == 'edit' && ($my->mp[0] == 1 || $upinfo['name'] == $my->id)) {
     $upper = $upinfo['name'];
     $tid = $upinfo['id'];
 } else {
     $upper = $my->id;
     $tid = 0;
 }
コード例 #20
0
ファイル: cms.php プロジェクト: BackupTheBerlios/viscacha-svn
     if ($qdir == '#') {
         if (!preg_match('/[^\\w\\d\\-\\.]/i', $qdir) || empty($ndir)) {
             $error = $lang->phrase('admin_wysiwyg_folder_restrictions');
         } else {
             if ($filesystem->mkdir($leadon . $ndir, 0777)) {
                 $path = $leadon . $ndir;
             }
         }
     }
     if ($error === null) {
         require "classes/class.upload.php";
         $my_uploader = new uploader();
         $my_uploader->max_filesize(ini_maxupload());
         $my_uploader->file_types($supportedextentions);
         $my_uploader->set_path($path);
         if ($my_uploader->upload('file')) {
             $my_uploader->save_file();
         }
         if ($my_uploader->upload_failed()) {
             $error = $my_uploader->get_error();
         }
         $image_file = $path . $my_uploader->fileinfo('filename');
         if (!file_exists($image_file)) {
             $error = $lang->phrase('admin_cms_file_does_not_exist');
         }
         $image_file = str_replace(realpath($config['fpath']) . DIRECTORY_SEPARATOR, '', $image_file);
         $image_file = str_replace(DIRECTORY_SEPARATOR, '/', $image_file);
     }
 }
 $filesize = formatFilesize(ini_maxupload());
 $htmlhead .= '<script type="text/javascript" src="templates/editor/wysiwyg-popup.js"></script>';
コード例 #21
0
<?php

include "../../connection/phpmysqlconnect.php";
include "../../lib/CRUD_lib.php";
include "../../lib/miss_lib.php";
// post data
// File processing
$ext_array = array("jpeg", "jpg", "png");
$mime_array = array("image/jpeg", "image/jpg", "image/png");
$location = "../../media/slider/";
$image = new uploader();
echo $_FILES['image']['name'];
if ($image->upload_validate($_FILES['image'], $ext_array, $mime_array) == true) {
    $image_name = $image->upload($_FILES['image'], $location);
    $column = array('slider');
    $value = array($image_name);
    $insert = new crud($conn, 'slider', $column, $value);
    $insert->insert();
    $move = new alert_redirect();
    $move->moveWithAlert('Slider has been added', '../../pages/slider.php');
}
$move = new alert_redirect();
$move->moveWithAlert('Error in uploading image', '../../pages/slider.php');