【发布时间】:2010-12-20 10:40:37
【问题描述】:
我正在尝试创建一个仅供个人使用的页面。我想要做的是,创建一个系统,通过该系统我可以直接通过像 WAMP 这样的 localhost 提供链接来将图像下载到我的本地硬盘。我想做的原因是,我希望图像自动分类到我的硬盘上。我的表单字段将是这样的
<form method="POST" action="process.php">
<input type="text" name="URL" id="URL" />
<input type="text" name="category" id="category" />
<input type="text" name="subcategory" id="category" />
<input type="submit">
</form>
现在,在process.php
//This is just a sample... So please ignore the roughness of the coding
copy($_POST['url'],$_POST['category']."/".$_POST['subcategory']."/somename.jpg");
// If you noticed, the categories and subcategories are actually the name of directory, where I want the picture to go be saved....
我认为我的方法是错误的。我怎样才能实现这样的目标?
错误
Warning: copy(images/image.jpg) [function.copy]: failed to open stream: No such file or directory in
【问题讨论】:
-
copy(source, destination),你的目的地在哪里? -
@ajreal,请仔细阅读这个问题,我相信你会找到上面提到的
$_POST['category']."/".$_POST['subcategory']."/somename.jpg"的目的地.. -
否,您的代码使用的是相对路径
-
@ajreal,你有什么建议,我可以使用
http://localhost/myimages/images/somename.jpg作为我的目的地 -
NO,你应该使用绝对路径,并确保目录已经创建并且你的服务器有足够的权限写入
标签: php curl download file-management