• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP ftp_fput函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ftp_fput函数的典型用法代码示例。如果您正苦于以下问题:PHP ftp_fput函数的具体用法?PHP ftp_fput怎么用?PHP ftp_fput使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: _putFile

 protected function _putFile($name, $contents)
 {
     $stream = $this->toStream($contents);
     $result = ftp_fput($this->getConnection(), $name, $stream, FTP_ASCII);
     fclose($stream);
     return $result;
 }
开发者ID:antimattr,项目名称:merchantry,代码行数:7,代码来源:FtpFileStore.php


示例2: iwp_mmb_direct_to_any_copy

 function iwp_mmb_direct_to_any_copy($source, $destination, $overwrite = false, $mode = false)
 {
     //FIX ME: directly call function in backup.class.php later
     global $wp_filesystem;
     if ($wp_filesystem->method == 'direct') {
         return $wp_filesystem->copy($source, $destination, $overwrite, $mode);
     } elseif ($wp_filesystem->method == 'ftpext' || $wp_filesystem->method == 'ftpsockets') {
         if (!$overwrite && $wp_filesystem->exists($destination)) {
             return false;
         }
         //put content
         $source_handle = fopen($source, 'r');
         if (!$source_handle) {
             return false;
         }
         $sample_content = fread($source_handle, 1024 * 1024 * 2);
         //1024 * 1024 * 2 => 2MB
         fseek($source_handle, 0);
         //Skip back to the start of the file being written to
         $type = $wp_filesystem->is_binary($sample_content) ? FTP_BINARY : FTP_ASCII;
         unset($sample_content);
         if ($wp_filesystem->method == 'ftpext') {
             $ret = @ftp_fput($wp_filesystem->link, $destination, $source_handle, $type);
         } elseif ($wp_filesystem->method == 'ftpsockets') {
             $wp_filesystem->ftp->SetType($type);
             $ret = $wp_filesystem->ftp->fput($destination, $source_handle);
         }
         fclose($source_handle);
         unlink($source);
         //to immediately save system space
         $wp_filesystem->chmod($destination, $mode);
         return $ret;
     }
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:34,代码来源:file_editor.class.php


示例3: subida_script

function subida_script($ftp_server, $ftp_user, $ftp_pass)
{
    // set up basic connection
    $conn_id = ftp_connect($ftp_server);
    if (!$conn_id) {
        echo "<div class='alert alert-warning' style='width:300px;margin:auto'>Connection established</div>";
    }
    // login with username and password
    $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);
    if ($login_result) {
        echo "<div class='alert alert-success' style='width:300px;margin:auto'>Connection established</div>";
    }
    ftp_chdir($conn_id, 'public_html');
    ftp_mkdir($conn_id, 'search');
    ftp_chdir($conn_id, 'search');
    ftp_mkdir($conn_id, 'css');
    ftp_chdir($conn_id, 'css');
    echo ftp_pwd($conn_id);
    ftp_chdir($conn_id, '../../autotienda/search');
    echo ftp_pwd($conn_id);
    //Uploading files...
    //to be uploaded
    $file = "search/.htaccess";
    $fp = fopen($file, 'r');
    ftp_fput($conn_id, $file, $fp, FTP_ASCII);
    echo ftp_pwd($conn_id);
    // close the connection
    ftp_close($conn_id);
    fclose($fp);
}
开发者ID:nuwem,项目名称:fitness,代码行数:30,代码来源:libconfig.php


示例4: stream_flush

 function stream_flush()
 {
     if (!isset($this->connect) || !isset($this->cacheWHandler)) {
         return;
     }
     rewind($this->cacheWHandler);
     ftp_fput($this->connect, $this->path, $this->cacheWHandler, FTP_BINARY, 0);
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:8,代码来源:class.ftpAccessWrapper.php


示例5: CreateFile

 public static function CreateFile($filename, $conn)
 {
     //Придумати щось інше
     $fp = fopen('for_test_ftp', "w");
     $response = ftp_fput($conn, $filename, $fp, FTP_ASCII);
     fclose($fp);
     unlink('for_test_ftp');
     return $response;
 }
开发者ID:KaPJICoH,项目名称:Filesystem,代码行数:9,代码来源:FileSystem.php


示例6: ftpWriteFile

function ftpWriteFile($ftpConn, $filepath, $contents, $ftpMode)
{
    // Create temp handler, this type needed for extended char set
    $tempHandle = fopen('php://temp', 'r+');
    // Write contents to handle and rewind head
    fwrite($tempHandle, $contents);
    rewind($tempHandle);
    // Write our content and return true/false
    return ftp_fput($ftpConn, $filepath, $tempHandle, $ftpMode, 0);
}
开发者ID:rasenderhase,项目名称:quocum,代码行数:10,代码来源:ftp-control.php


示例7: fput

 public function fput($remote, $handle, $mode = FTP_BINARY)
 {
     if ($this->_ftpStream) {
         if (!ftp_fput($this->_ftpStream, $remote, $handle, $mode)) {
             echo "Error in fput writing to {$remote}";
             return false;
         }
         return true;
     }
     return false;
 }
开发者ID:ssrsfs,项目名称:blg,代码行数:11,代码来源:Ftp.php


示例8: putcontent

 public function putcontent($filename, $content)
 {
     if (!($temp = $this->gettempfilehandle())) {
         return false;
     }
     fseek($temp, 0);
     fwrite($temp, $content);
     ftruncate($temp, strlen($content));
     fseek($temp, 0);
     $result = @ftp_fput($this->handle, $filename, $temp, FTP_BINARY);
     return $result;
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:12,代码来源:remote.ftp.class.php


示例9: write

 /**
  * {@InheritDoc}
  */
 public function write($key, $content)
 {
     $path = $this->computePath($key);
     $directory = dirname($path);
     $this->ensureDirectoryExists($directory, true);
     $temp = fopen('php://temp', 'r+');
     $size = fwrite($temp, $content);
     rewind($temp);
     if (!ftp_fput($this->getConnection(), $path, $temp, FTP_ASCII)) {
         throw new \RuntimeException(sprintf('Could not write the \'%s\' file.', $key));
     }
     fclose($temp);
     return $size;
 }
开发者ID:ruudk,项目名称:Gaufrette,代码行数:17,代码来源:Ftp.php


示例10: saveFTP

 /**
  * Enregistre le fichier sur un serveur FTP
  *
  * @param resource $ftp_stream -> La ressource de connexion FTP
  * @param string   $path       -> Le chemin complet du dossier de destination
  * @param string   $filename   -> Le nom du fichier
  * @return true si réussi, sinon false
  */
 public function saveFTP($ftp_stream, $path, $filename)
 {
     // Ouverture du flux "input" de PHP et création d'un fichier temp
     $input = fopen("php://input", "r");
     $temp = tmpfile();
     $realSize = stream_copy_to_stream($input, $temp);
     fclose($input);
     if ($realSize != $this->getSize()) {
         return false;
     }
     // Enregistre le fichier sur le FTP
     fseek($temp, 0, SEEK_SET);
     return ftp_fput($ftp_stream, $path . $filename, $temp, FTP_BINARY);
 }
开发者ID:keverage,项目名称:webftp,代码行数:22,代码来源:upload.class.php


示例11: write

 /**
  * {@inheritDoc}
  */
 public function write($key, $content)
 {
     $path = $this->computePath($key);
     $directory = dirname($path);
     $this->ensureDirectoryExists($directory, true);
     $temp = fopen('php://temp', 'r+');
     $size = fwrite($temp, $content);
     rewind($temp);
     if (!ftp_fput($this->getConnection(), $path, $temp, $this->mode)) {
         fclose($temp);
         return false;
     }
     fclose($temp);
     return $size;
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:18,代码来源:Ftp.php


示例12: up

 public function up($source, $dest_file, $mimetype)
 {
     if (!$this->connect_id) {
         return false;
     }
     $mode = preg_match('/text/i', $mimetype) || preg_match('/html/i', $mimetype) ? FTP_ASCII : FTP_BINARY;
     if (is_resource($source)) {
         $res = ftp_fput($this->connect_id, $dest_file, $source, $mode);
     } else {
         $res = ftp_put($this->connect_id, $dest_file, $source, $mode);
     }
     if ($res) {
         ftp_site($this->connect_id, 'CHMOD 0644 ' . $dest_file);
     }
     return $res;
 }
开发者ID:cbsistem,项目名称:nexos,代码行数:16,代码来源:cpg_ftp.php


示例13: write

 /**
  * {@inheritdoc}
  */
 public function write($key, $content)
 {
     $this->ensureDirectoryExists($this->directory, $this->create);
     $path = $this->computePath($key);
     $directory = str_replace('\\', '/', \Gaufrette\Util\Path::dirname($path));
     $this->ensureDirectoryExists($directory, true);
     $temp = fopen('php://temp', 'r+');
     $size = fwrite($temp, $content);
     rewind($temp);
     if (!ftp_fput($this->getConnection(), $path, $temp, $this->mode)) {
         fclose($temp);
         return false;
     }
     fclose($temp);
     return $size;
 }
开发者ID:NiR-,项目名称:Gaufrette,代码行数:19,代码来源:Ftp.php


示例14: createAction

 /**
  * @Route("/backup", name="create_backup")
  * @Method("GET")
  * @Template()
  */
 public function createAction()
 {
     //echo PHP_OS;
     //include_once "conexion/def.php";
     set_time_limit(6000);
     date_default_timezone_set("America/El_Salvador");
     $backupFile = "laplusbelle_" . date("d-m-Y_H-i-s") . ".sql";
     $path = $this->container->getParameter('plusbelle.backup');
     $kernel = $this->get('kernel');
     //$path = $kernel->locateResource('@DGPlusbelleBundle/backup/'.$backupFile);
     $path = $this->get('kernel')->locateResource("@DGPlusbelleBundle/Resources/backup/");
     //var_dump($path);
     //$pathdirname($this->container->getParameter('kernel.root_dir')) . '/web/bundles/mybundle/myfiles'
     //    if(strpos(strtolower($path), 'win') !== false){
     //        $path=str_replace("/","\\",$path);
     //    }
     //var_dump($path);
     try {
         /////Hay que dar permisos al usuario de la base de datos, LOCK TABLES y SHOW DATABASES
         exec("mysqldump -h localhost -uadmin -p919293marvin marvinvi_demo_plusbella -R> " . $path . $backupFile);
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     //die();
     // open some file for reading
     $file = 'backup/' . $backupFile;
     $file1 = $path . $backupFile;
     $fp = fopen($file1, 'r');
     // set up basic connection
     $conn_id = ftp_connect("digitalitygarage.com");
     $ftp_user_name = "[email protected]";
     $ftp_user_pass = "919293marvin";
     // login with username and password
     $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
     // try to upload $file
     if (ftp_fput($conn_id, $file, $fp, FTP_ASCII)) {
         echo "Successfully uploaded {$file}\n";
     } else {
         echo "There was a problem while uploading {$file}\n";
     }
     // close the connection and the file handler
     ftp_close($conn_id);
     fclose($fp);
     die;
     //    return $this->redirect($this->generateUrl('admin_backup'));
     return $this->redirect($this->generateUrl('admin_backup', array('estado' => '0')));
 }
开发者ID:samrodriguez,项目名称:plusbella,代码行数:52,代码来源:BackupController.php


示例15: doUpload

 /**
  * Execute upload action and return URL.
  *
  * @return string|false
  *
  * @throws Exception If have an error occurred
  */
 protected function doUpload()
 {
     $level = error_reporting(E_ALL & ~E_WARNING);
     $this->getStream();
     $subfolder = date('Y/m/d');
     $this->preparePath($subfolder);
     $fpfile = fopen($this->file, 'r');
     $filename = $this->getRemoteFileName($this->file);
     $result = ftp_fput($this->stream, $filename, $fpfile, FTP_BINARY);
     fclose($fpfile);
     if (!$result) {
         $this->throwException('Cannot upload to this host "%s:%s", path: "%s"', $this->host, $this->port, $path);
     }
     $link = $this->getHostLink() . '/' . $subfolder . '/' . $filename;
     error_reporting($level);
     return $link;
 }
开发者ID:windieselz,项目名称:php-remote-image-uploader,代码行数:24,代码来源:Host.php


示例16: save

 function save($path = '', $url, $id)
 {
     $system =& $GLOBALS['system'];
     $fp = fopen(BASE_DIR . $path, 'rb');
     $id = $path;
     $url = "http://" . __FTP_SERVER__ . "/" . $path;
     $ftp_path = __FTP_DIR__ . "/" . $path;
     $file = $ftp_path;
     // connect to the server
     $conn_id = ftp_connect(__FTP_SERVER__);
     $login_result = ftp_login($conn_id, __FTP_UNAME__, __FTP_PASSWD__);
     $d = split("/", $ftp_path);
     $ftp_path = "";
     if (substr(__FTP_DIR__, 0, 1) == "/") {
         $i = 1;
     } else {
         $i = 0;
     }
     for ($i; $i < count($d) - 1; $i++) {
         $ftp_path .= "/" . $d[$i];
         if (!@ftp_chdir($conn_id, $ftp_path)) {
             @ftp_chdir($conn_id, "/");
             if (!@ftp_mkdir($conn_id, $ftp_path)) {
                 return false;
             }
         }
     }
     // try to upload the file
     ftp_fput($conn_id, $file, $fp, FTP_BINARY);
     $o = $system->loadModel('goods/gimage');
     foreach ($o->defaultImages as $tag) {
         $ext = $o->getImageExt(BASE_DIR . $path);
         $otherimage = substr(BASE_DIR . $path, 0, strlen(BASE_DIR . $path) - strlen($ext)) . "_" . $tag . $ext;
         if (file_exists($otherimage)) {
             $fp = fopen($otherimage, 'rb');
             ftp_fput($conn_id, $ftp_path . "/" . basename($otherimage), $fp, FTP_BINARY);
             fclose($fp);
             @unlink($otherimage);
         }
     }
     @unlink(BASE_DIR . $path);
     // close the connection and the file handler
     ftp_close($conn_id);
     fclose($fp);
     return true;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:46,代码来源:ftp_storage.php


示例17: put_contents

 function put_contents($file, $contents)
 {
     $result = false;
     if ($ftp = AkFtpClient::connect()) {
         $file = str_replace('\\', '/', $file);
         $tmpfname = tempnam('/tmp', 'tmp');
         $temp = fopen($tmpfname, 'a+');
         fwrite($temp, $contents);
         fclose($temp);
         $temp = fopen($tmpfname, 'rb');
         ftp_pasv($ftp, true);
         $result = ftp_fput($ftp, $file, $temp, FTP_ASCII);
         fclose($temp);
         unlink($tmpfname);
     }
     return $result;
 }
开发者ID:BackupTheBerlios,项目名称:phpbase-svn,代码行数:17,代码来源:AkFtpClient.php


示例18: SaveComment

function SaveComment($id, $comment)
{
    $temp = fopen('php://temp', 'r+');
    $ftp = GetFtpHandle();
    if ($ftp !== false) {
        ftp_fget($ftp, $temp, $id . ".comment", FTP_BINARY, 0);
        fwrite($temp, $comment . "\r\n");
        rewind($temp);
        if (ftp_fput($ftp, $id . ".comment", $temp, FTP_BINARY)) {
            fclose($temp);
            ftp_close($ftp);
            return true;
        }
        ftp_close($ftp);
    }
    fclose($temp);
    return false;
}
开发者ID:0140454,项目名称:WebCourse,代码行数:18,代码来源:comment.php


示例19: updateGAzieCart

function updateGAzieCart($server,$user,$pass,$data,$filename)
{
    gaz_set_time_limit (30); // azzero il tempo altrimenti vado in fatal_error
    $fn_exp = explode("/", $filename);
    $filename=array_pop($fn_exp);
    // set up a connection or die
    $conn_id = @ftp_connect($server);
    if (!$conn_id){
        return '0+'; // torno l'errore di server
    }
    // faccio il login
    if (!@ftp_login($conn_id, $user, $pass)) {
            ftp_close($conn_id);
            return '1+'; // torno l'errore di login
    }
    //turn passive mode on
    ftp_pasv($conn_id, true);
    foreach( $fn_exp as $dir){
        // faccio i cambi di direttorio
        if (!@ftp_chdir($conn_id, $dir)) {
            ftp_close($conn_id);
            return '2+'; // torno l'errore di direttorio inesistente
        }
    }
    // scrivo il file temporaneamente sul filesystem del server
    // quindi questo file deve poter essere scritto da Apache, quindi i permessi devono essere giusti
    $fp=fopen('gaziecart.tmp','w+');
    fwrite($fp,$data);
    fclose($fp);
    // elimino il file sul sito per poterlo riscrivere
    $fp=fopen('gaziecart.tmp','r');
    @ftp_delete($conn_id, $filename);
    // faccio l'upload del nuovo file
    if (!@ftp_fput($conn_id, $filename,$fp, FTP_BINARY)) {
            fclose($fp);
            ftp_close($conn_id);
            return '3+'; // torno l'errore di file
    }
    fclose($fp);
    // close the connection
    ftp_close($conn_id);
    return false;
}
开发者ID:andreabia,项目名称:gazie,代码行数:43,代码来源:gaziecart_update.php


示例20: updateFilesState

 /**
  * Update the NSN ftp server files states.
  * @param type $filesToUpdate An array of updated files states.
  * @throws Exception 
  */
 public function updateFilesState($filesToUpdate)
 {
     $processedPath = $this->_path . DIRECTORY_SEPARATOR . $this->outgoingFilename;
     $outgoingFile = $this->getRemoteFile($processedPath);
     //do the updating : seek to the file record and update its timestamp.
     foreach ($filesToUpdate as $id => $value) {
         if ($id > 0 && $value['state'] == static::FILE_STATE_FULL && isset($value['updated']) && $value['updated'] == true) {
             fseek($outgoingFile, $id * static::OUTGOING_RECORD_SIZE);
             $strTime = date('siHdmy', $value['time']) . substr(date('Y', $value['time']), 0, 2);
             fwrite($outgoingFile, pack('H*', $strTime), static::OUTGOING_RECORD_SIZE);
         }
     }
     fflush($outgoingFile);
     fseek($outgoingFile, 0);
     //upload the updated file to the server.
     if (!ftp_fput($this->_ftp->getConnection(), $processedPath, $outgoingFile, FTP_BINARY)) {
         throw new Exception('couldnt upload ' . static::OUTGOING_FILE_NAME . ' File from NSN server');
     }
     fclose($outgoingFile);
 }
开发者ID:ngchie,项目名称:system,代码行数:25,代码来源:Nsn.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ftp_get函数代码示例发布时间:2022-05-15
下一篇:
PHP ftp_fget函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap