小编use*_*846的帖子

使用multipart/form-data上传卷曲文件

我有curl文件上传的问题.我想在视频托管网站上传我的服务器文件.脚本需要Content-type: multipart/form-dataContent-type: video/mp4,但我不知道如何做到这一点.上传文件后有content type application/octet-stream.

这是脚本

class curl
{
         function __construct($use = 1)
         {
         $this->ch = curl_init();
                 if($use = 1)
                 {
                         curl_setopt ($this->ch, CURLOPT_POST, 1);
                         curl_setopt ($this->ch, CURLOPT_COOKIEJAR, 'cookie.txt');
                         curl_setopt ($this->ch, CURLOPT_FOLLOWLOCATION, 1);
                         curl_setopt ($this->ch, CURLOPT_RETURNTRANSFER, 1);
                 }
                 else
                 {
                         return 'There is the possibility, that this script wont work';
                 }
         }
         function first_connect($loginform,$logindata)
         {
                 curl_setopt($this->ch, CURLOPT_URL, $loginform);
                 curl_setopt($this->ch, CURLOPT_POSTFIELDS, $logindata);
         }
         function store()
         {
                 $this->content = curl_exec ($this->ch);
         }
         function execute($page)
         {
                 curl_setopt($this->ch, …
Run Code Online (Sandbox Code Playgroud)

php upload curl

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

curl ×1

php ×1

upload ×1