我正在尝试将某个文件从http站点下载到localhost中的我的文件夹,但是我收到此错误Warning: copy(files): failed to open stream: Permission denied
。我已经尝试设置文件夹files
的权限并取消选中Readonly,但是不能保持未选中方形填充蓝色的某种方式。还尝试安装不同的软件以启用它也尝试转到属性 - >安全并从那里启用,但仍然没有。这是脚本:
PHP
<?php
function recurse_copy($source,$dst) {
if(is_dir($source)) {
$dir_handle=opendir($source);
while($file=readdir($dir_handle)){
if($file!="." && $file!=".."){
if(is_dir($source."/".$file)){
if(!is_dir($dest."/".$file)){
mkdir($dest."/".$file);
}
copy($source."/".$file, $dest."/".$file);
} else {
copy($source."/".$file, $dest."/".$file);
}
}
}
closedir($dir_handle);
} else {
copy($source, $dst);
}
}
$source = isset($_POST['source']) ? $_POST['source'] : ''; // this would be a http://www.domain.com/folder
$dst = 'files'; //also tried: F:/SERVER/htdocs/scripts/download-files-with-specific-extention/files
recurse_copy($source,$dst);
?>
HTML
<form id="form" name="download" action="" method="post">
Source <input class="field" type="text" name="source" value="<?php echo $source; ?>"><br>
Destination <input class="field" type="text" name="destination" value="<?php echo $dst; ?>">
<input id="button" type="submit" name="download" value="Get Files">
</form>