当前位置: 首页>>代码示例>>PHP>>正文


PHP Upload::uploadFile方法代码示例

本文整理汇总了PHP中Upload::uploadFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Upload::uploadFile方法的具体用法?PHP Upload::uploadFile怎么用?PHP Upload::uploadFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Upload的用法示例。


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

示例1: uploadFile

 public function uploadFile($replaceWhiteSpaceWith = NULL)
 {
     if (isset($_FILES) && sizeof($_FILES) > 0 && pathinfo($_FILES["files"]['name'][0], PATHINFO_EXTENSION) != "zip") {
         $chk = array();
         $chk['bool'] = false;
         $chk['error'] = true;
         $chk['message'] = $this->notifications_CFG([message => "File uploaded was not a 'zip' file!!!"]);
         $chk['file'] = $_FILES["files"]['name'][0];
         die(json_encode($chk));
     } else {
         return parent::uploadFile($replaceWhiteSpaceWith);
     }
 }
开发者ID:awwthentic1234,项目名称:hey,代码行数:13,代码来源:CompileUpload.php

示例2: updateKontrak

 public function updateKontrak()
 {
     if (isset($_POST['update_kontrak'])) {
         $kontrak = new Kontrak();
         $kontrak->kd_kontrak = $_POST['kd_kontrak'];
         $kontrak->no_kontrak = $_POST['nomor'];
         $kontrak->kd_jurusan = $_POST['jur'];
         $kontrak->tgl_kontrak = date('Y-m-d', strtotime($_POST['tanggal']));
         $kontrak->thn_masuk_kontrak = $_POST['tahun_masuk'];
         $kontrak->jml_pegawai_kontrak = $_POST['jml_peg'];
         $kontrak->lama_semester_kontrak = $_POST['lama_semester'];
         $kontrak->nilai_kontrak = str_replace(',', '', $_POST['nilai_kontrak']);
         $kontrak->kontrak_lama = $_POST['kontrak_lama'];
         $upload = new Upload();
         $upload->init('fupload');
         //var_dump($kontrak);
         if ($upload->getFileName() != "") {
             $upload->setDirTo('files/');
             $nama = array($kontrak->no_kontrak, $kontrak->tgl_kontrak);
             $upload->changeFileName($upload->getFileName(), $nama);
             $file_baru = $upload->getFileTo();
             $kontrak->file_kontrak = $file_baru;
         } else {
             $file_lama = $_POST['fupload_lama'];
             $kontrak->file_kontrak = $file_lama;
         }
         if ($kontrak->isEmpty($kontrak) == false) {
             //var_dump($kontrak);
             $kontrak->update($kontrak);
             if ($file_baru != "") {
                 $upload->uploadFile();
             }
             header('location:' . URL . 'kontrak/display');
         } else {
             $url = URL . 'kontrak/editKontrak/' . $kontrak->kd_kontrak;
             header("refresh:1;url=" . $url);
             echo "Isian form belum lengkap";
             //header('location:' . URL . 'kontrak/editKontrak/');
         }
     } else {
         header('location:' . URL . 'kontrak/display');
     }
 }
开发者ID:nazimkabiri,项目名称:sims-beasiswa,代码行数:43,代码来源:KontrakController.php

示例3: do_invite

 public function do_invite(View $view)
 {
     $formul = $view->getPOST('form', false);
     $user = Session::get_user();
     if ($formul && $user) {
         $files = $view->getFILES();
         $uploader = new Upload($files);
         $nombres = $uploader->uploadFile();
         foreach ($nombres as $nombre) {
             if (($handle = fopen($nombre, "r")) !== FALSE) {
                 while (($datos = fgetcsv($handle, 1000, ";")) !== FALSE) {
                     $nombre = $datos[0];
                     $apellidos = $datos[1];
                     $identificacion = $datos[2];
                     $email = $datos[3];
                     mail($email, "Inivitacion a responder un formulario en q-stad", "Cordialmente se le esta invitando la siguiente encuesta que aparece en el link que aparece a continuacion http://q-stad.alwaysdata.net/?ID=ver/resp/form&form={$formul}");
                 }
                 fclose($handle);
             }
         }
         return $view->response_ok();
     }
     return $view->response_error();
 }
开发者ID:exildev,项目名称:q-stad,代码行数:24,代码来源:Service.php

示例4: Upload

     } else {
         if (@$_POST['path'] == '') {
             $upload = new Upload();
             $upload->dir = 'media/download/' . $category['uniqid'] . '/';
             if (!is_dir($upload->dir)) {
                 mkdir($upload->dir, 0777, true);
             }
             @chmod($upload->dir, 0777);
             $upload->tag_name = 'file';
             $upload->allowed_types = '(.*)';
             if ($config->get('media', 'max-upload-size') > 0) {
                 $upload->max_byte_size = $config->get('media', 'max-upload-size');
             } else {
                 $upload->max_byte_size = 10485760;
             }
             $msg = $upload->uploadFile();
             if ($msg == 0) {
                 @addDownload($categoryid, $_POST['name'], $_POST['description'], $upload->file_name, $_POST['version'], $_POST['release_notes'], $_POST['thumbnail'], $_POST['disable']);
                 redirect(makeURL($mod, array('categoryid' => $categoryid)));
             } else {
                 $notify->add($lang->get('media'), 'Upload Failed. Error Code ' . $msg);
             }
         } else {
             @addDownload($categoryid, $_POST['name'], $_POST['description'], $_POST['path'], $_POST['version'], $_POST['release_notes'], $_POST['thumbnail'], $_POST['disable']);
             redirect(makeURL($mod, array('categoryid' => $categoryid)));
         }
     }
 } else {
     $breadcrumbs->addElement($lang->get('adddownload'), makeURL($mod, array('categoryid' => $categoryid, 'mode' => 'adddownload')));
     $smarty->assign('files', listAvailableDownloads());
     $smarty->assign('path', $template_dir . "/adddownload.tpl");
开发者ID:tech-nik89,项目名称:lpm4,代码行数:31,代码来源:media.mod.php

示例5: Upload

 if (@$_GET['path'] == '') {
     $_GET['path'] = $dir;
 }
 if (@is_dir($_GET['path'])) {
     // Create Folder
     if (isset($_POST['create_dir']) && trim($_POST['create_dir_name']) != '' && !is_dir($_GET['path'] . '/' . $_POST['create_dir_name'])) {
         @mkdir($_GET['path'] . '/' . $_POST['create_dir_name'], 0777);
         @chmod($_GET['path'] . '/' . $_POST['create_dir_name'], 0777);
     }
     // Upload File
     if (isset($_POST['upload_file'])) {
         $ul = new Upload();
         $ul->allowed_types = '*';
         $ul->dir = $_GET['path'] . '/';
         $ul->max_byte_size = $max_size;
         $result = $ul->uploadFile();
         if (0 != $result) {
             $notify->add($lang->get('fileadmin'), 'Upload failed: ' . $result);
         }
     }
     // Delete File
     if (isset($_POST['delete_file_filename'])) {
         unlink($_GET['path'] . '/' . $_POST['delete_file_filename']);
     }
     // Delete Folder
     if (isset($_POST['delete_dir'])) {
         @rmdir($_GET['path']);
     }
 }
 // Make directory tree
 $root['name'] = 'fileadmin';
开发者ID:tech-nik89,项目名称:lpm4,代码行数:31,代码来源:fileadmin.mod.php

示例6: unlink

             $element = $db->selectOne($tbl_ad, 'img', "`adid`=" . (int) $id);
             unlink('./media/boximages/ad/' . $element);
             $db->delete($tbl_ad, "adid=" . $id);
         } else {
             if (substr($ad['url'], 0, 7) != "http://") {
                 $ad['url'] = "http://" . $ad['url'];
             }
             $db->update($tbl_ad, "url='" . $ad['url'] . "'", "adid=" . $id);
         }
     }
 }
 if ($_FILES['image']['size'] > 0) {
     $upload = new Upload();
     $upload->dir = 'media/boximages/ad/';
     $upload->tag_name = 'image';
     $upload->uploadFile();
     $imgdir = "./media/boximages/ad/";
     include_once './core/simple.image.core.php';
     $image = new SimpleImage();
     $image->load($imgdir . $upload->file_name);
     if ($image->getWidth() > (int) $config->get('ad', 'standard_image_width')) {
         $image->resizeToWidth((int) $config->get('ad', 'standard_image_width'));
     }
     if ($image->getHeight() > (int) $config->get('ad', 'standard_image_height')) {
         $image->resizeToHeight((int) $config->get('ad', 'standard_image_height'));
     }
     unlink($imgdir . $upload->file_name);
     $image->save($imgdir . $upload->file_name);
     if (substr($_POST['newurl'], 0, 7) != "http://") {
         $_POST['newurl'] = "http://" . $_POST['newurl'];
     }
开发者ID:tech-nik89,项目名称:lpm4,代码行数:31,代码来源:ad.mod.php

示例7: saveItem

 /**
  * 
  * @param unknown $arrayParam
  * @param string $option
  */
 public function saveItem($arrayParam, $option = null)
 {
     require_once LIBRARY_EXT_PATH . 'Upload.php';
     $uploadObj = new Upload();
     if ($option['task'] == 'add') {
         $arrayParam['form']['picture'] = $uploadObj->uploadFile($arrayParam['form']['picture'], 'book', 98, 150);
         $arrayParam['form']['created'] = date('Y-m-d', time());
         $arrayParam['form']['created_by'] = 1;
         $arrayParam['form']['description'] = mysqli_real_escape_string($this->connect, $arrayParam['form']['description']);
         $arrayParam['form']['name'] = mysqli_real_escape_string($this->connect, $arrayParam['form']['name']);
         $data = array_intersect_key($arrayParam['form'], array_flip($this->_columns));
         $this->insert($data);
         Session::set('message', array('class' => 'success', 'content' => 'Data was inserted successfully'));
         return $this->lastID();
     }
     if ($option['task'] == 'edit') {
         // Khong cho thay doi username
         unset($arrayParam['form']['username']);
         $arrayParam['form']['modified'] = date('Y-m-d', time());
         $arrayParam['form']['modified_by'] = 10;
         $arrayParam['form']['description'] = mysqli_real_escape_string($this->connect, $arrayParam['form']['description']);
         $arrayParam['form']['name'] = mysqli_real_escape_string($this->connect, $arrayParam['form']['name']);
         if ($arrayParam['form']['picture']['name'] == null) {
             unset($arrayParam['form']['picture']);
         } else {
             $uploadObj->removeFile('book', $arrayParam['form']['picture_hidden']);
             $uploadObj->removeFile('book', '98x150-' . $arrayParam['form']['picture_hidden']);
             $arrayParam['form']['picture'] = $uploadObj->uploadFile($arrayParam['form']['picture'], 'book', 98, 150);
         }
         $data = array_intersect_key($arrayParam['form'], array_flip($this->_columns));
         $this->update($data, array(array('id', $arrayParam['form']['id'])));
         Session::set('message', array('class' => 'success', 'content' => 'Data was inserted successfully'));
         return $arrayParam['form']['id'];
     }
 }
开发者ID:shimia90,项目名称:PHP-Training,代码行数:40,代码来源:BookModel.php

示例8: ubahLampiran

 public function ubahLampiran()
 {
     $id_lamp = $_POST['id'];
     $id_surat = $_POST['id_surat'];
     $tgl = $_POST['tanggal'];
     $jns = $_POST['jenis'];
     $tipe = $_POST['tipe'];
     $nomor = $_POST['nomor'];
     $asal = $_POST['asal'];
     $hal = $_POST['hal'];
     $ket = $_POST['keterangan'];
     //nama baru akan terdiri dari tipe naskah_nomor surat_asal(asal/tetapi asal terlaku kepanjangan)
     if ($_FILES['upload']['name'] != '') {
         $upload = new Upload('upload');
         $upload->setDirTo('arsip/');
         $ubahNama = array($tipe, $nomor);
         $upload->setUbahNama($ubahNama);
         $upload->changeFileName($upload->getFileName(), $ubahNama);
         $namafile = $upload->getFileTo();
     } else {
         $filex = $_POST['file'];
         $file = explode("_", $filex);
         $j = count($file);
         $ext = explode('.', $file[$j - 1]);
         //            var_dump($ext);
         //            var_dump($file);
         //            $namafile = explode("_", $file);
         //            var_dump($namafile);
         $file[0] = $tipe;
         $namafile = '';
         for ($i = 0; $i < $j - 1; $i++) {
             $namafile .= '_' . $file[$i];
             echo $file[$i] . '</br>';
         }
         $namafile = trim($namafile, "_") . '_' . $ext[0] . '.' . $ext[1];
         //            var_dump($namafile);
         //            $namafile = implode("_", $namafile);
         rename('arsip/' . $filex, 'arsip/' . $namafile);
     }
     //$upload->init('upload');
     $lamp = new Lampiran_Model();
     $lamp->set('id_lamp', $id_lamp);
     $lamp->set('jns_surat', $jns);
     $lamp->set('id_surat', $id_surat);
     $lamp->set('tipe', $tipe);
     $lamp->set('nomor', $nomor);
     $lamp->set('tanggal', $tgl);
     $lamp->set('asal', $asal);
     $lamp->set('hal', $hal);
     $lamp->set('keterangan', $ket);
     $lamp->set('file', $namafile);
     /*$data = array(
           'jns_surat'=>$jns,
           'id_surat'=>$_POST['id'],
           'tipe'=>$tipe,
           'nomor'=>$nomor,
           'tanggal'=>  Tanggal::ubahFormatTanggal($_POST['tanggal']),
           'hal'=>$_POST['hal'],
           'asal'=>$asal,
           'keterangan'=>$_POST['keterangan'],
           'file'=>$namafile//upload belom diurus
       );*/
     //var_dump($data);
     if ($lamp->editLampiran()) {
         if ($_FILES['upload']['name'] != '') {
             $upload->uploadFile();
         }
         echo "<div id=success>Ubah data lampiran berhasil</div>";
     } else {
         echo "<div id=error>Ubah data lampiran gagal!</div>";
     }
     /*if($jns=='SM'){
           header('location:'.URL.'suratmasuk/detil/'.$data['id_surat']);
       }elseif ($jns=='SK') {
           header('location:'.URL.'suratkeluar/detil/'.$data['id_surat']);
       }*/
     //        return true;
 }
开发者ID:ryderonil,项目名称:sisurip,代码行数:78,代码来源:lampiran_controller.php

示例9: uploadFileSurat

 public function uploadFileSurat()
 {
     $upload = new Upload('upload');
     $upload->setDirTo('arsip/');
     $tipe = 'M';
     $satker = $_POST['satker'];
     $nomor = $_POST['nomor'];
     //nama baru akan terdiri dari tipe naskah_nomor surat_asal(asal/tetapi asal terlaku kepanjangan)
     $ubahNama = array($tipe, $nomor, $satker);
     $upload->setUbahNama($ubahNama);
     $upload->changeFileName($upload->getFileName(), $ubahNama);
     $namafile = $upload->getFileTo();
     $where = ' id_suratmasuk=' . $_POST['id'];
     $data = array('file' => $namafile);
     if ($upload->uploadFile()) {
         $this->model->uploadFile($data, $where);
         $datastat = array('stat' => '14');
         @Session::createSession();
         $user = Session::get('user');
         $log = new Log();
         $log->addLog($user, 'UPLOAD', 'user ' . $user . ' upload file surat no agenda ' . $this->model->getNomorAgenda($_POST['id']) . ' file:' . $namafile);
         unset($log);
         $this->model->update('suratmasuk', $datastat, $where);
         //update status -> pelaksana
         echo "<div id=success>Upload file berhasil</div>";
     } else {
         echo "<div id=error>Upload file berhasil</div>";
     }
     //        return true;
     //header('location:'.URL.'suratmasuk');
 }
开发者ID:ryderonil,项目名称:sisurip,代码行数:31,代码来源:suratmasuk_controller.php

示例10: uploadFile

 /**
  * Upload file action
  */
 public function uploadFile()
 {
     $this->uploader->setRequest(Request::createFromGlobals());
     $result = $this->uploader->uploadFile();
     echo json_encode($result);
 }
开发者ID:andrewkrug,项目名称:repucaution,代码行数:9,代码来源:upload.php

示例11: Upload

<?php

header('content-type:text/html;charset=utf-8');
require_once 'upload.class.php';
$upload = new Upload('myFile1', 'captain');
$dest = $upload->uploadFile();
echo $dest;
开发者ID:captaim,项目名称:upload.class.php,代码行数:7,代码来源:doAction2.php

示例12: htmlspecialchars

<?php

require 'php/Upload.class.php';
$token = '';
if (isset($_REQUEST['token'])) {
    $token = htmlspecialchars(substr($_REQUEST['token'], 0, 6));
}
$result = false;
if (isset($_FILES['file'])) {
    $upload = new Upload();
    if ($upload->uploadFile($token, $_FILES['file'])) {
        $result = 'Datei erfolgreich hochgeladen.';
    } else {
        $result = 'Datei konnte nicht hochgeladen werden.';
    }
}
?>
<!doctype html>
<html>
    <head>
        <title>uploadtool</title>
        <script type="text/javascript" src="js/jquery-2.1.0.min.js"></script>
        <script type="text/javascript" src="js/upload.js"></script>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="css/upload.css">
        <link rel="search" href="http://upload.beheh.de/search.xml" type="application/opensearchdescription+xml" title="upload/download">
    </head>
    <body ondragenter="">
        <h1><a href="http://upload.beheh.de">Uploadtool</a></h1>
        <form enctype="multipart/form-data" method="post" action=".">
            <table>
开发者ID:beheh,项目名称:upload,代码行数:31,代码来源:index.php

示例13: uploadrev

 public function uploadrev()
 {
     $return = true;
     $notif = new Notifikasi();
     $id = $_POST['id'];
     $catatan = $_POST['catatan'];
     $user = $_POST['user'];
     //        var_dump($catatan);
     $time = date('Y-m-d H:i:s');
     $filename = '';
     $datas = $this->model->getSuratById($id, 'detil');
     //        foreach ($datas as $val){
     $filename = $datas->getFile();
     //        }
     //---------------------------------
     $fln = array();
     if (file_exists('arsip/temp/' . $filename)) {
         //jika file telah ada di folder temp/
         $temp = explode('.', $filename);
         //            var_dump($temp);
         $sql = "SELECT file FROM revisisurat WHERE file LIKE '{$temp['0']}%'";
         $file = $this->model->select($sql);
         //            var_dump($file);
         if (count($file > 0)) {
             if (count($file) == 1) {
                 $pisah = explode('.', $filename);
                 $nama = $pisah[0];
                 $ext = $pisah[1];
                 var_dump($ext);
                 $filename = $nama . '_1.' . $ext;
                 //                    var_dump($filename);
                 //                    break;
             } else {
                 foreach ($file as $val) {
                     $temp = explode('.', $val['file']);
                     $pisah = explode('_', $temp[0]);
                     if (count($pisah) <= 3) {
                         $fln[] = 0;
                     } else {
                         $fln[] = $pisah[3];
                     }
                     //                        $fln[] = explode('_', $temp[0]);
                     //                        var_dump($fln);
                     //                        $len = count($temp);
                     //                        $fln[] = (int) ($len-1); //mengambil array terakhir
                     $num = max($fln);
                     //                        var_dump($num);
                     $filename = $pisah[0] . '_' . $pisah[1] . '_' . $pisah[2] . '_' . ($num + 1) . '.' . $temp[1];
                     //                        var_dump($filename);
                 }
             }
         }
     }
     //-----------------------------------
     $data = array('id_surat' => $id, 'catatan' => $catatan, 'user' => $user, 'file' => $filename, 'time' => $time);
     $ext = explode(".", $filename);
     if ($ext[count($ext) - 1] == 'pdf') {
         //jika telah diupload tipe file pdf
         if (file_exists('arsip/' . $filename)) {
             copy('arsip/' . $filename, 'arsip/temp/' . $filename);
         }
         //copykan ke folder temp/
     } else {
         $upload = new Upload('upload');
         //jika tidak, upload file tersebut
         $upload->setDirTo('arsip/temp/');
         $upload->setFileTo($filename);
         $upload->uploadFile();
     }
     //upload file revisi
     //        $upl = $upload->uploadFile(); //upload dengan nama beda jika sudah terdapat file di arsip
     //        if(!$upl){
     //            $return = "Gagal upload! cek file dan ekstensi, ekstensi harus pdf, doc atau docx";
     //        }
     $role = Session::get('role');
     /*
      * alurnya klo revisi kasi->pelaksana
      * revisi kk -> kasi dan pelaksana :siiip
      * otak atik dari awak lagi, ternyata butuh field user/creator surat keluar yg berisi pelaksananya siapa
      */
     //var_dump($id);
     $notif->set('id_surat', $id);
     //cek lagi
     $notif->set('jenis_surat', 'SK');
     $notif->set('stat_notif', 1);
     $user = $this->model->getUser($id);
     //var_dump($user);
     $notif->set('bagian', $user[2]);
     if ($role == 1) {
         $dataks = $this->model->select("SELECT id_user FROM user WHERE role=2 AND bagian =" . $user[2] . " AND active='Y'");
         foreach ($dataks as $val) {
             $notif->set('id_user', $val['id_user']);
         }
         $notif->set('role', 2);
         //tambah notifikasi untuk kasi
         $notif->addNotifikasi();
     }
     $notif->set('id_user', $user[0]);
     $notif->set('role', $user[1]);
     //tambah notifikasi untuk pelaksana
//.........这里部分代码省略.........
开发者ID:ryderonil,项目名称:sisurip,代码行数:101,代码来源:suratkeluar_controller.php

示例14: uploadFile

 /**
  * Upload file action
  */
 public function uploadFile()
 {
     $this->uploader->setRequest(Request::createFromGlobals());
     $result = $this->uploader->uploadFile();
     $this->renderJson($result);
 }
开发者ID:andrewkrug,项目名称:repucaution,代码行数:9,代码来源:upload.php

示例15: Upload

<?php

include 'Upload.class.php';
$upload = new Upload();
if (!empty($_POST['action']) && $_POST['action'] == 'upload') {
    $upload->uploadFile('/files/', 'md5', 10);
    ?>
	<script>
		setTimeout('document.location="test.php"',1000);
	</script>
	<?php 
    print_r($upload->_files);
}
//$upload->imgResize('filename', '/files/', 800, true);
//$upload->deleteFile('filename', '/files/');
?>
<form action="<?php 
echo $_SERVER['PHP_SELF'];
?>
" method="POST" name="upload" ENCTYPE="multipart/form-data">
<input type="file" name="file1"><br>
<input type="file" name="file2"><br>
<input type="file" name="file3"><br>
<input type="file" name="file4"><br>
<input type="file" name="file5"><br>
<input type="submit" value="Забросить">
<input type="hidden" name="action" value="upload">
</form>
开发者ID:rajibahmed,项目名称:AHR,代码行数:28,代码来源:test.php


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