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


PHP ftp_fput函数代码示例

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


在下文中一共展示了ftp_fput函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 = "laplusbelle@digitalitygarage.com";
     $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


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