【发布时间】:2014-03-01 23:47:23
【问题描述】:
我有一个现有的脚本,我正在尝试修改它,而不是从 PC 中选择要上传的文件,而是添加相关图像的 URL。我一直在尝试使用获取文件功能,我可以使用它从 url 中获取文件并上传到服务器,但我希望它捕获文件并传递到现有脚本的其余部分以完成调整大小等.
见下文....
$thumburl = "http://url of image file";
$thumb = file_get_contents($thumburl);
$space = $_POST['thumb']['size'];
move_uploaded_file($_POST['thumb']['tmp_name'], $config['TMP_DIR']. '/thumbs/' .$thumb);
@chmod($config['TMP_DIR']. '/' .$thumb, 0644);
$ff = $config['TMP_DIR']. '/thumbs/' .$thumb;
$fd = $config['TMB_DIR']. '/' .$thid. '.jpg';
createThumb($ff, $fd, $config['img_max_width'], $config['img_max_height']);
copy($fd, $config['TMB_DIR']. '/1_' .$thid. '.jpg');
copy($fd, $config['TMB_DIR']. '/2_' .$thid. '.jpg');
copy($fd, $config['TMB_DIR']. '/3_' .$thid. '.jpg');
@unlink($config['TMP_DIR']. '/thumbs/' .$thumb);
【问题讨论】:
标签: php url file-upload upload