當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Ftp::close方法代碼示例

本文整理匯總了PHP中Ftp::close方法的典型用法代碼示例。如果您正苦於以下問題:PHP Ftp::close方法的具體用法?PHP Ftp::close怎麽用?PHP Ftp::close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Ftp的用法示例。


在下文中一共展示了Ftp::close方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: process

 /**
  * @param DatabaseBackupFile $file
  * @return ResultObject[]
  */
 public function process(DatabaseBackupFile $file)
 {
     $d = $file->getBackupDate();
     $results = [];
     foreach ($this->uploadsCredentials as $credentials) {
         $result = new ResultObject();
         // empty ResultObject means all is OK
         $backupPath = $credentials['path'] . '/' . $d->format('Y') . '/' . $d->format('F');
         $entireFilePath = $backupPath . '/' . $file->getFileName();
         try {
             $ftp = new \Ftp();
             $ftp->connect($credentials['host']);
             $ftp->login($credentials['username'], $credentials['password']);
             if (!$ftp->fileExists($backupPath)) {
                 $ftp->mkDirRecursive($backupPath);
             }
             $ftp->put($entireFilePath, $file->getFilePath(), FTP_BINARY);
             $ftp->close();
         } catch (\FtpException $e) {
             $this->logger->addCritical(sprintf('Uploading backup file\'s failed. %s', $e));
             $result->addError('Zálohu se nepodařilo nahrát na: ' . $credentials['host'], 'error');
         }
         $results[] = $result;
     }
     return $results;
 }
開發者ID:blitzik,項目名稱:vycetky-doctrine,代碼行數:30,代碼來源:DatabaseBackupFileHandler.php

示例2: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $menu = $model->attributes;
     if (isset($_POST['FrontMenu'])) {
         $model->attributes = $_POST['FrontMenu'];
         foreach ($this->uploadArr as $column) {
             $file = CUploadedFile::getInstance($model, $column);
             //獲取表單名為filename的上傳信息
             if ($file) {
                 $model->{$column} = $this->uploadIcon($file);
                 if ($menu[$column]) {
                     $ftp = new Ftp();
                     $res = $ftp->delete_file('common/frontmenu/' . $menu[$column]);
                     $ftp->close();
                 }
             } else {
                 unset($model->{$column});
             }
         }
         if (!$model->ParentID) {
             $model->ParentID = 0;
         }
         if ($model->save()) {
             $this->freshMenuCache();
             $this->redirect(array('admin'));
         }
     }
     $this->render('update', array('model' => $model));
 }
開發者ID:zwq,項目名稱:unpei,代碼行數:35,代碼來源:FrontmenuController.php

示例3: update

 /**
  * Ist für den Abgleich der Bestellungen im Cronjob.
  */
 public function update()
 {
     global $selectline, $oxid, $ftp;
     $this->set_log('Cronjob: ' . date('d.m.Y H:i:s') . "\r\n");
     try {
         $ftp = new Ftp();
         $ftp->connect($oxid['ftp_host']);
         $ftp->login($oxid['ftp_user'], $oxid['ftp_password']);
         $ftp->close();
     } catch (Exception $e) {
         $this->set_log('SelectConnect konnte keine Verbindung zum FTP-Server herstellen!');
         exit;
     }
     if (!oxid_userlogin()) {
         $this->set_log('SelectConnect konnte sich nicht bei Oxid einloggen!');
         exit;
     }
     if (!$this->is_current_update_process()) {
         $this->set_log("Cronjob wurde gestartet \r\n");
         $this->set_lock_file();
         $last_update = $this->get_last_update();
         $this->set_log("Bestellungen werden in Selectline importiert \r\n");
         $orders = $oxid['db']->get_results("SELECT * FROM " . $oxid['table_order'] . " WHERE OXFOLDER  = '" . $oxid['get_order_status'] . "' ORDER BY OXORDERNR");
         if ($orders) {
             foreach ($orders as $order) {
                 $order_products = $oxid['db']->get_results("SELECT * FROM " . $oxid['table_orderarticles'] . " WHERE OXORDERID = '" . $order->OXID . "' ");
                 $order->products = $order_products;
                 $order_payment = $oxid['db']->get_row("SELECT * FROM " . $oxid['table_payments'] . " WHERE ('" . $order->OXPAYMENTTYPE . "' = OXID)");
                 $order->payment = $order_payment;
                 $this->set_order_to_selectline($order, true);
                 $oxid['db']->query("UPDATE " . $oxid['table_order'] . " SET OXFOLDER = '" . $oxid['set_order_status'] . "', OXEXPORT = 1 WHERE `OXID` = '" . $order->OXID . "' ");
             }
         }
         $this->set_log("Bestellungstatus wird abgeglichen \r\n");
         $orders = $selectline['db']->get_results("SELECT * FROM " . $selectline['table_orders'] . " WHERE [Belegtyp] = '" . $selectline['filter_order_invoice'] . "' AND [BearbeitetAm] >= CONVERT(datetime, '" . $last_update->format('d.m.Y H:i:s') . "',104)");
         if ($orders) {
             foreach ($orders as $order) {
                 $tracking_id = $this->get_tracking_id_from_selectline($order);
                 $updateArray = array('OXBILLNR' => $order->Belegnummer, 'OXBILLDATE' => $order->Datum->format('Y-m-d'), 'OXSENDDATE' => $order->Datum->format('Y-m-d H:i:s'), 'OXFOLDER' => $oxid['order_status_finish']);
                 if ($tracking_id !== NULL) {
                     $updateArray['OXTRACKCODE'] = $tracking_id;
                 }
                 //print_r($this->format_update_query($oxid['table_order'], $updateArray, array('OXORDERNR' => str_replace('OX', '', $order->IhrAuftrag))));
                 $oxid['db']->query($this->format_update_query($oxid['table_order'], $updateArray, array('OXORDERNR' => str_replace('OX', '', $order->IhrAuftrag))));
                 $this->set_log("Bestellung " . $order->IhrAuftrag . "/" . $order->Belegnummer . " - Status: FINISHED - Tracking: " . $tracking_id . " \r\n");
             }
         }
         $this->set_last_update();
         $this->remove_lock_file();
         $this->set_log("Cron wurde beendet \r\n");
         $this->set_log("\r\n##################################\r\n\r\n");
     } else {
         print_r('Error: Es läuft bereits Update-Prozess.');
     }
 }
開發者ID:baltruschat,項目名稱:selectconnect,代碼行數:58,代碼來源:orders.php

示例4: get_ftp_content

function get_ftp_content($source, $target)
{
    $result = false;
    $config = array('hostname' => FTP_HOST, 'username' => FTP_USER, 'password' => FTP_PASSWORD, 'port' => FTP_PORT, 'timeout' => FTP_TIMEOUT);
    $ftp = new Ftp();
    $ftp->connect($config);
    if ($ftp->existsFile($source)) {
        $result = $ftp->download($source, $target);
    } else {
        access_log('log', 'No documents.');
        //clear_file();
    }
    $ftp->close();
    return $result;
}
開發者ID:hardyswang,項目名稱:down_ftp_zip_and_unzip,代碼行數:15,代碼來源:get_ftp_list.php

示例5: set_product_images_oxid

 /**
  * [set_product_images_oxid description]
  * @param [type] $product [description]
  */
 private function set_product_images_oxid($product)
 {
     global $oxid, $selectline;
     $product->images = $selectline['db']->get_results("SELECT * FROM " . $selectline['table_product_img'] . " WHERE [Blobkey] = 'AR" . $product->Artikelnummer . "'");
     if ($product->images) {
         $i = 1;
         $ftp = new Ftp();
         $ftp->connect($oxid['ftp_host']);
         $ftp->login($oxid['ftp_user'], $oxid['ftp_password']);
         foreach ($product->images as $image) {
             $img = WideImage::load($image->Bild);
             if ($i > 1) {
                 $filename = $product->ART_ID . '_' . $i . '.jpg';
             } else {
                 $filename = $product->ART_ID . '.jpg';
             }
             $img->saveToFile(ABSPATH . '/images/' . $filename);
             $ftp->put($oxid['img_path'] . '/master/product/' . $i . '/' . $filename, ABSPATH . '/images/' . $filename, FTP_BINARY);
             @unlink(ABSPATH . '/images/' . $filename);
             $oxid['db']->query($this->format_update_query($oxid['table_products'], array('OXPIC1' => $filename), array('OXID' => $product->ART_ID)));
             $i++;
         }
         $ftp->close();
     }
 }
開發者ID:baltruschat,項目名稱:selectconnect,代碼行數:29,代碼來源:products.php

示例6: Ftp

	<script src="js/jquery-2.1.3.min.js"></script>
	<script src="js/jQuery.ajaxQueue.js"></script>
	<script src="bootstrap/js/bootstrap.min.js"></script>
	<script src="bootstrap/js/bootstrap-select.min.js"></script>

</head>
<body class="<?php 
echo $action;
?>
">
<?php 
try {
    $ftp = new Ftp();
    $ftp->connect($oxid['ftp_host']);
    $ftp->login($oxid['ftp_user'], $oxid['ftp_password']);
    $ftp->close();
} catch (Exception $e) {
    print_r('<p class="alert alert-danger">SelectConnect konnte keine Verbindung zum FTP-Server herstellen!</p>');
    $action = 'error';
}
if (!oxid_userlogin()) {
    print_r('<p class="alert alert-danger">SelectConnect konnte sich nicht bei Oxid einloggen!</p>');
    $action = 'error';
}
switch ($action) {
    case 'orders':
        $orders = new Orders();
        $items = $orders->import();
        ?>
			<h1>SelectConnect | Bestellungen</h1>
			<p>Es wurden <?php 
開發者ID:baltruschat,項目名稱:selectconnect,代碼行數:31,代碼來源:index.php

示例7: forward_suobei

 public function forward_suobei($id)
 {
     //獲取視頻id
     $sql = 'SELECT content_id,vodid FROM ' . DB_PREFIX . 'materials WHERE content_id IN (' . $id . ') AND vodid !=""';
     $query = $this->db->query($sql);
     $k = array();
     while ($row = $this->db->fetch_array($query)) {
         $k[$row['content_id']] = $row['vodid'];
     }
     $ids = '';
     $ret = array();
     if (!empty($k)) {
         //獲取視頻信息
         $ids = implode(',', $k);
         $keys = array_keys($k);
         $vodpath = array();
         //獲取報料標題
         $sql = 'SELECT id,title FROM ' . DB_PREFIX . 'content WHERE id IN (' . implode(',', $keys) . ')';
         $query = $this->db->query($sql);
         $title = array();
         while ($row = $this->db->fetch_array($query)) {
             $title[$row['id']] = $row['title'];
         }
         $title = array_combine($k, $title);
         $ftp = $this->settings['App_suobei']['ftp'];
         $ids = implode(',', $k);
         $ret = $this->get_vodinfo($ids, $ftp['host'], $ftp['username'], $ftp['password']);
         $vodpath = array();
         if (!empty($ret) && is_array($ret)) {
             foreach ($ret as $key => $val) {
                 $vodpath[$val['id']] = $ret[$key];
             }
         } else {
             $this->errorOutput('ftp上傳失敗');
         }
     }
     if (!empty($vodpath) && !empty($title)) {
         //獲取報料標題
         //寫xml文件
         $this->vod_xml($vodpath, $title);
         //ftp上傳
         //實例化ftp,並連接
         $ftp_config = array('hostname' => $ftp['host'], 'username' => $ftp['username'], 'password' => $ftp['password']);
         $ftp_up = new Ftp();
         if (!$ftp_up->connect($ftp_config)) {
             $this->errorOutput('CAN NOT CONNECT FTP SERVER');
         }
         foreach ($vodpath as $k => $v) {
             $target_dir = $v['dir'] . '/';
             $target_path = $target_dir . $v['filename'] . '.xml';
             $xml_filepath = $this->settings['App_suobei']['xmldir'] . $v['filename'] . '.xml';
             if (!file_exists($xml_filepath)) {
                 $this->errorOutput('CAN NOT FIND XML');
             }
             if (!$ftp_up->mkdir($target_dir)) {
                 $this->errorOutput('CAN NOT MAKE DIR');
             }
             if (!$ftp_up->upload($xml_filepath, $target_path)) {
                 $this->errorOutput('CAN NOT UPLOAD FILE');
             }
         }
         $ftp_up->close();
         //更新狀態位
         $sql = 'UPDATE ' . DB_PREFIX . 'content SET suobei=1 WHERE id IN (' . implode(',', $keys) . ')';
         $this->db->query($sql);
     }
     return $id;
 }
開發者ID:h3len,項目名稱:Project,代碼行數:68,代碼來源:contribute.class.php

示例8: upload2ftp

 public function upload2ftp()
 {
     $config = json_decode($this->input['config'], 1);
     $files = json_decode($this->input['files'], 1);
     include_once ROOT_PATH . 'lib/class/ftp.class.php';
     $ftp = new Ftp();
     $server_dir = trim($config['server_dir'], '/');
     $app_dir = $config['app_dir'];
     $message = array('error' => 0);
     if (!$ftp->connect($config)) {
         $message['error'] = 1;
         $message['message'] = '連接服務器失敗[' . $config['hostname'] . ']';
     }
     if ($server_dir && !$message['error']) {
         if (!$ftp->mkdir($server_dir)) {
             $message['error'] = 2;
             $message['message'] = '目標目錄不存在且創建失敗[' . $server_dir . ']';
         }
     }
     if (!$files && !$message['error']) {
         $message['error'] = 3;
         $message['message'] = '文件列表不存在[' . $files . ']';
     }
     if (!$message['error']) {
         foreach ($files as $file) {
             if (!file_exists($file)) {
                 //continue;
             }
             //返回上傳錯誤的文件
             $dfile = str_replace($app_dir, '', $file);
             //如果設定了ftp目標目錄
             $dfile = $server_dir ? $server_dir . $dfile : $dfile;
             $upload_dir = trim(str_replace('/' . basename($file), '', $dfile), '/');
             if ($upload_dir) {
                 $ftp->mkdir($upload_dir);
             }
             if (!$ftp->upload($file, $dfile)) {
                 $message['error'] = 4;
                 $message['message'][$file] = $dfile;
             }
         }
     }
     //file_put_contents(CACHE_DIR . 'debug.txt', var_export($config,1));
     $ftp->close();
     $this->addItem($message);
     $this->output();
 }
開發者ID:h3len,項目名稱:Project,代碼行數:47,代碼來源:configuare_frm.php

示例9: actionSaveserviceorgan

 /**
  * 公司信息保存
  */
 public function actionSaveserviceorgan()
 {
     $OrganID = Yii::app()->user->getOrganID();
     $Organ = Yii::app()->request->getParam("Organ");
     $arr = Yii::app()->request->getParam("telPhone");
     $TelPhone = "";
     foreach ($arr as $key => $val) {
         if (empty($val)) {
             continue;
         }
         $TelPhone .= $val . ",";
     }
     $model = Organ::model()->findByPK($OrganID);
     if (empty($model)) {
         $model = new Organ();
     }
     //保存organ數據
     $model->attributes = $Organ;
     $model->TelPhone = trim($TelPhone, ',');
     //判斷基本信息是否為空,為空則不提交
     if ($Organ) {
         //接收刪除圖片的地址
         $photoId = Yii::app()->request->getParam("photoId");
         //判斷是否刪除圖片
         if (!empty($photoId)) {
             $imageids = explode(',', $photoId);
             foreach ($imageids as $imageid) {
                 $picture = OrganPhoto::model()->find('Path=:img AND OrganID=:OrganID', array(':img' => $imageid, ':OrganID' => $OrganID));
                 //判斷該圖片路徑是否存在數據庫中
                 if (empty($picture)) {
                     $ftp = new Ftp();
                     $res = $ftp->delete_file($imageid);
                     $ftp->close();
                 } else {
                     OrganPhoto::model()->deleteAll('Path=:img AND OrganID=:OrganID', array(':img' => $imageid, ':OrganID' => $OrganID));
                     $ftp = new Ftp();
                     $res = $ftp->delete_file($picture->Path);
                     $ftp->close();
                 }
             }
         }
         //接收上傳圖片地址
         $goodsImages = Yii::app()->request->getParam("goodsImages");
         //判斷是否有上傳圖片
         if (!empty($goodsImages)) {
             $imglegth = count($goodsImages);
             for ($i = 0; $i < $imglegth; $i++) {
                 $goodsImg = new OrganPhoto();
                 $goodsImg->OrganID = $OrganID;
                 $goodsImg->Path = $goodsImages[$i];
                 $goodsImg->save();
             }
         }
         //判斷是否上傳營業執照
         $BLPoto = Yii::app()->request->getParam("BLPoto");
         if ($model->BLPoto != $BLPoto) {
             if (!empty($model->BLPoto)) {
                 $ftp = new Ftp();
                 $res = $ftp->delete_file($model->BLPoto);
                 $ftp->close();
             }
             $model->BLPoto = $BLPoto;
         }
         //接收service數據
         $service = Yii::app()->request->getParam("Service");
         $opentime = Yii::app()->request->getParam("OpenTime");
         //保存service數據
         $servicemodel = Service::model()->find("OrganID=:organid", array(":organid" => $OrganID));
         if (empty($servicemodel)) {
             //判斷是否第一次添加
             $servicemodel = new Service();
             $servicemodel->OrganID = $OrganID;
         }
         $servicemodel->PositionCount = $service['PositionCount'];
         $servicemodel->TechnicianCount = $service['TechnicianCount'];
         $servicemodel->ParkingDigits = $service['ParkingDigits'];
         $servicemodel->ReservationMode = $service['ReservationMode'];
         $servicemodel->ShopArea = $service['ShopArea'];
         $servicemodel->OpenTime = $opentime[0] . ',' . $opentime[1] . ',' . $opentime[2] . ',' . $opentime[3];
         //$model->attributes = $Organ;
         if ($servicemodel->save() && $model->save()) {
             //保存成功
             //$file->saveAs(Yii::app()->params['uploadPath'].$model->Logo, true);
             $this->redirect(array('index'));
         } else {
             var_dump($goodsImg->errors);
             die;
         }
     }
 }
開發者ID:zwq,項目名稱:unpei,代碼行數:93,代碼來源:ServicecompanyController.php

示例10: actionEditlogo

 public function actionEditlogo()
 {
     $organID = Yii::app()->user->OrganID;
     //organ表單驗證
     $model = Organ::model()->findByPK($organID);
     if ($model->Logo) {
         //刪除
         $ftp = new Ftp();
         $res = $ftp->delete_file($model->Logo);
         $ftp->close();
     }
     //獲得一個CUploadedFile的實例
     $file = CUploadedFile::getInstanceByName('Logo');
     $rs = array('code' => 100, 'msg' => '上傳失敗!' . $ImgName . '已經上傳');
     $upload = Yii::app()->params['uploadPath'] . 'tmp/logo/' . $organID . '/';
     $path = Yii::app()->params['uploadPath'] . 'tmp/';
     if (!is_dir($upload)) {
         mkdir($upload, 0777, true) or die('創建失敗');
         chmod($upload, 0777);
     }
     // 判斷實例化是否成功
     if (is_object($file) && get_class($file) === 'CUploadedFile') {
         $model->Logo = 'logo/' . $organID . '/' . 'file_' . date("YmdHis") . '_' . rand(1000, 9999) . '.' . $file->extensionName;
         //定義文件保存的名稱
     }
     /* else{  // 若果失敗則應該是什麽圖片  
        $model->url = './assets/upfile/noPic.jpg';
        } */
     if ($model->save()) {
         $file->saveAs($path . $model->Logo, true);
         $ftp = new Ftp();
         $res = $ftp->uploadfile($path . $model->Logo, $model->Logo);
         $ftp->close();
         @unlink($path . $model->Logo);
     }
     $this->redirect(array('index'));
 }
開發者ID:zwq,項目名稱:unpei,代碼行數:37,代碼來源:InfomanagerController.php

示例11: actualiza

 /**
  * Cambia el nombre de una imagen existente
  *
  * Actualiza el nombre nuevo en la tabla de imagenes y cambia
  * el nombre al archivo físico
  *
  * @param string $titulo El titulo de la imagen
  * @param string $slug El nombre de la imagen sin limpiar
  * @param booelan $mostrarPieFoto TRUE si se quiere mostrar el titulo en el pie de la imagen
  * @param array $documento Array con los parametros del documento
  * @param booelan $idThumbnail
  * @param integer $orden
  * @return boolean TRUE si se cambió con Exito
  */
 public function actualiza()
 {
     $ok = TRUE;
     // Cargo los datos del objeto antes de cambiarlos
     $doc = new CpanDocs($this->getId());
     $pathName = $doc->getPathName();
     $nombreAnterior = $doc->getName();
     unset($doc);
     // Si el nombre propuesto es distinto al que ya tiene y no es Thumbnail
     // recalculo el nombre amigable, cambio el path y renombro el archivo
     $this->actualizaNombreAmigable();
     $nombreNuevo = $this->getName();
     $pathInfo = pathinfo($pathName);
     $carpetaDestino = $this->_prePath . $pathInfo['dirname'];
     $ftp = new Ftp($_SESSION['project']['ftp']);
     $ok = $ftp->rename($carpetaDestino, $nombreAnterior, $nombreNuevo);
     $this->_errores = $ftp->getErrores();
     $ftp->close();
     unset($ftp);
     if ($this->_ArrayDoc['tmp_name'] != '') {
         $ok = $this->subeDocumento();
     }
     // Si todo ha ido bien, actualizo el objeto
     if ($ok) {
         $this->save();
     }
     unset($this);
     return $ok;
 }
開發者ID:albatronic,項目名稱:hermes,代碼行數:43,代碼來源:CpanDocs.class.php

示例12: actionUploadFile

 public function actionUploadFile()
 {
     $path = $_POST['path'];
     if (!empty($_FILES)) {
         $oldfileName = $_FILES['Filedata']['name'];
         $ext = substr($oldfileName, strrpos($oldfileName, ".") + 1);
         $filesize = $_FILES['Filedata']['size'];
         //上傳文件大小
         $fileName = $this->getRandomName($oldfileName);
         $tmpFile = $_FILES['Filedata']['tmp_name'];
         //緩存文件路徑
         //$type = $_FILES['Filedata']['type']; //上傳文件類型
         $tp = array('gif', 'jpg', 'png', 'bmp', 'jpeg', 'doc', 'docx', 'xls', 'xlsx', 'txt');
         //檢查上傳文件是否在允許上傳的類型
         if (!in_array($ext, $tp)) {
             echo json_encode(array('code' => 1, 'msg' => '隻能發送圖片、文檔、表格等文件'));
             die;
         }
         if (in_array($ext, array('gif', 'jpg', 'png', 'bmp', 'jpeg'))) {
             $ftype = 1;
         } else {
             $ftype = 2;
         }
         //檢查文件大小
         $max_size = 2 * 1024 * 1024;
         //2M
         if ($filesize > $max_size) {
             echo json_encode(array('code' => 0, 'msg' => '上傳文件大小超過限製,不允許超過2M '));
             die;
         }
         //上傳文件臨時保存路徑
         $tmpsavepath = Yii::app()->params['uploadPath'] . 'tmp/';
         if (!file_exists($tmpsavepath)) {
             if (!@mkdir($tmpsavepath, 0777, true)) {
                 echo json_encode(array('code' => 0, 'msg' => '臨時保存目錄創建失敗 - ' . $tmpsavepath));
                 die;
             } else {
                 chmod($tmpsavepath, 0777);
             }
         }
         //檢查目錄寫權限
         if (@is_writable($tmpsavepath) === false) {
             echo json_encode(array('code' => 0, 'msg' => '臨時保存目錄沒有寫權限 - ' . $tmpsavepath));
             die;
         }
         $tmpsavefile = $tmpsavepath . basename($tmpFile);
         if (@move_uploaded_file($tmpFile, $tmpsavefile) === false) {
             echo json_encode(array('code' => 0, 'msg' => '文件保存失敗 - ' . $tmpsavefile));
             die;
         }
         $fileurl = $path . $fileName;
         // 新文件名
         $ftp = new Ftp();
         $res = $ftp->uploadfile($tmpsavefile, $fileurl);
         $ftp->close();
         if ($res['success']) {
             @unlink($tmpsavefile);
             //刪除臨時文件
             echo json_encode(array('code' => 200, 'ftype' => $ftype, 'fileurl' => $fileurl, 'filename' => $oldfileName, 'msg' => '上傳成功!'));
         } else {
             echo json_encode(array('code' => 0, 'msg' => $res['msg']));
         }
     } else {
         echo json_encode(array('code' => 0, 'msg' => '請選擇文件!'));
     }
 }
開發者ID:zwq,項目名稱:unpei,代碼行數:66,代碼來源:ChatController.php

示例13: actionDelPto

 public function actionDelPto()
 {
     $imageid = Yii::app()->request->getParam("imageid");
     $ftp = new Ftp();
     $res = $ftp->delete_file($imageid);
     $ftp->close();
     echo json_encode($res);
 }
開發者ID:zwq,項目名稱:unpei,代碼行數:8,代碼來源:OrderreviewController.php

示例14: ftp_upload

 /**
  * ftp上傳
  * @param $file_path:本地文件的路徑
  * @param $savename:文件名 
  * @return 1;上傳成功<br>
  *         0;上傳失敗
  */
 private function ftp_upload($ftp_file_path, $local_file_path, $savename, $type)
 {
     import("@.ORG.Ftp");
     $ftp = new Ftp();
     $conn = $ftp->connect('w1.weimg.cn', 'images', 'images580230', $port = '21', $pasv = false, $ssl = false, $timeout = 30);
     $ftp->mkdir($ftp_file_path);
     $res = $ftp->put($ftp_file_path . $savename, $local_file_path . $savename);
     if ($type == 4) {
         $ftp->put($ftp_file_path . 's_' . $savename, $local_file_path . 's_' . $savename);
         unlink('./Public/upload/s_' . $savename);
     }
     $ftp->close();
     unlink('./Public/upload/' . $savename);
     if (!$res) {
         return 0;
     } else {
         return 1;
     }
 }
開發者ID:YouthAndra,項目名稱:huaitaoo2o,代碼行數:26,代碼來源:FileService.class.php

示例15: SubirPlantillaAction

 /**
  * Sube al servidor el archivo de plantilla a la carpeta
  * docs/docsXXX/circulares/plantillas.
  * 
  * Debe existir la carpeta docs/docsXXX/circulares.
  * Se sube usando ftp.
  * 
  * @return type
  */
 public function SubirPlantillaAction()
 {
     $fichero = $this->request['FILES']['filePlantilla'];
     if (in_array($fichero['type'], $this->tiposPermitidos)) {
         $carpetaPlantillas = $_SESSION['appPath'] . "/docs/docs{$_SESSION['emp']}/circulares/plantillas";
         Archivo::creaCarpeta($carpetaPlantillas);
         if (is_uploaded_file($fichero['tmp_name'])) {
             $ftp = new Ftp($_SESSION['project']['ftp']);
             if ($ftp) {
                 $ok = $ftp->upLoad($carpetaPlantillas, $fichero['tmp_name'], $fichero['name']);
                 $this->_errores = $ftp->getErrores();
                 $ftp->close();
             } else {
                 $this->_errores[] = "Fallo al conectar vía FTP";
                 foreach ($_SESSION['project']['ftp'] as $item) {
                     $this->_errores[] = $item;
                 }
             }
         }
     } else {
         $this->_errores[] = "Tipo de archivo no permitido. Sólo se admiten archivos rtf,txt y html";
     }
     $this->values['errores'] = $this->_errores;
     return $this->IndexAction();
 }
開發者ID:albatronic,項目名稱:agentescloud,代碼行數:34,代碼來源:Circulares.class.php


注:本文中的Ftp::close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。