【发布时间】:2012-10-03 00:55:04
【问题描述】:
我想将我的文件远程上传到接受上传的服务器 使用 curl ,但无需每次都使用“@”符号输入完整的文件路径 我可以制作一个浏览按钮来选择文件然后继续 curl 上传
这是我的代码::
$post = array("file_box"=>"@/path/to/myfile.jpg");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://remote-site");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$output = curl_exec($ch);
curl_close($ch);
return $output;
只想通过浏览按钮更改“@/path/to/myfile.jpg”,将其值传递给 php 变量
我想改变这个 [[ $post = array("file_box"=>"@/path/to/myfile.jpg"); ]]
类似的事情
[[ $post = array("file_box"=>"@".$variable_contains_file_path_from_browse_button); ]]
防止将文件上传到临时路径中的中间服务器(托管此脚本),只是从客户端直接到远程服务器
有什么解决办法吗
感谢大家的帮助。
【问题讨论】:
标签: php file-upload curl