#httpd.conf <Directory "e:/www/images"> Options All AllowOverride All </Directory> ----------------------------------------------------------------- 但,按你的Warning: Unable to open '' for reading: Permission denied in e:\www\php_exam\transfile.php on line 2 Unable to open ''而没写成 Unable to open 'somefile.ext'...
我试了一下: Warning: Unable to create '/images/53.jpg': No such file or directory in c:\apache1.3.22\htdocs\test\transfile.php on line 2我改为 //transfile.php <?php copy($myfile,"c:/apache1.3.22/htdocs/images/".$myfile_name); echo "success"; ?> 就通过了。不知为何相对路径不行。学习中...
<?php
copy($myfile,"/images/".$myfile_name);
//你的form里<input name="myfile" type="file">,这里怎么是 $myfile_name呢?
echo "success";
?>
变量名 说明
$myfile 即上传的文件内容
$myfile_name 上传文件在用户端的名称
$myfile_size 上传文件的大小
$myfile_type 上传文件的格式,如 "image/gif"
若在 form 中配置 input file 的名称改掉,则在 transfile.php的变量也一起改,如<input name="upfile" type="file">则变量就改成 $upfile、$upfile_name、$upfile_size、与 $upfile_type。
<Directory "e:/www/images">
Options All
AllowOverride All
</Directory>
-----------------------------------------------------------------
但,按你的Warning: Unable to open '' for reading: Permission denied in e:\www\php_exam\transfile.php on line 2
Unable to open ''而没写成 Unable to open 'somefile.ext'...
Warning: Unable to create '/images/53.jpg': No such file or directory in c:\apache1.3.22\htdocs\test\transfile.php on line 2我改为
//transfile.php
<?php
copy($myfile,"c:/apache1.3.22/htdocs/images/".$myfile_name);
echo "success";
?>
就通过了。不知为何相对路径不行。学习中...
第一个问题应该是权限不够,如果是ntfs应该检查系统中和apache中的
权限问题