php教程|php手册
php,curl,模仿,ftp,文件,上传,代码,php,教程,curl,模仿,ftp,文件,上传,代码,body,fo
php教程-php手册
php教学 curl模仿ftp文件上传代码
html5 博饼游戏源码,vscode界面不一样,ubuntu 加密主目录,tomcat调用dll闪退,sqlite内存索引,网页设计图片页面风格,vps 云主机 云服务器,竖标签页切换插件,游戏前端框架 白鹭,爬虫蓝奏云,拼图php,最有名的seo,springboot群架构图,网站禁止右键代码,css平移效果的网页,java bootstrap模板,怎么网站后台,html5简单的登录页面,在线教育管理系统,怎样在vb程序只允许扫 一种码制的条形码lzw
discuz源码下载,ubuntu卡死启动界面,网页爬虫中文乱码,php combine,seo内容架构lzw
<?
if (isset($_post[‘submit’])) {
if (!empty($_files[‘upload’][‘name’])) {
$ch = curl_init();
$localfile = $_files[‘upload’][‘tmp_name’];
$fp = fopen($localfile, ‘r’);
curl_setopt($ch, curlopt_url, ‘ftp://ftp_login:password@/’.$_files[‘upload’][‘name’]);
curl_setopt($ch, curlopt_upload, 1);
curl_setopt($ch, curlopt_infile, $fp);
curl_setopt($ch, curlopt_infilesize, filesize($localfile));
curl_exec ($ch);
$error_no = curl_errno($ch);
curl_close ($ch);
if ($error_no == 0) {
$error = ‘file uploaded succesfully.’;
} else {
$error = ‘file upload error.’;
}
} else {
$error = ‘please select a file.’;
}
}
?>
微信图文编辑器源码V5,ubuntu 18修复系统,python如何伪装爬虫,php sql循环,启东seo公司lzw
好了下面封闭成类了
<?php
class curl_ftp
{
private $ftpname;//ftp用户名
private $ftppaw; //ftp密码
private $urlftp; //ftp地址
private $filename; //文件名
public __construct($name, $password, $ftp)
{
$this->ftpname = $name;
$this->ftppaw = $password;
$this->urlftp = $ftp;
// $this->filename = $filename;
}
public function getftp()
{
if (isset($_post[‘submit’]))
{
if (!empty($_files[‘upload’][‘name’]))
{
$ch = curl_init();
$this->filename = $_files[‘upload’][‘tmp_name’];
$fp = fopen($this->filename, ‘r’);
curl_setopt($ch, curlopt_url, $this->ftp.$this->filename);
curl_setopt($ch, curlopt_userpwd, “$name:password”);
curl_setopt($ch, curlopt_upload, 1);
curl_setopt($ch, curlopt_infile, $fp);
curl_setopt($ch, curlopt_infilesize, filesize($this->filename));
curl_exec ($ch);
$error_no = curl_errno($ch);
curl_close ($ch);
if ($error_no == 0)
{
$error = ‘文件上传成功’;
}
else
{
$error = ‘文件上传失败’;
}
}
else
{
$error = ‘未选择文件’;
}
}
}
}