开始用别人写好的类但是老是显示 error0 就是没有任何文件上传。
最后自己稍微自己逐步减代码测试下发现还是那个错误。搞不懂为什么。上图。上代码。我是在手机上测试。
___index.php
<form action="upload.php" method="post" enctype="multipart/form-data" >
name: <input type="text" name="username" value="" /><br>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
up pic: <input type="file" name="myfile" value=""><br>
<input type="submit" value="upload" /><br> </form>
___upload.php
<?php
require "upfile.class.php";
$up = new Uploade;
$up->upfile();
?>
___upfile.class.php
<?php
class Uploade{
function upfile(){
if($_FILES['myfile']['error']=0){
if($_FILES['myfile']['size']<10000000){
echo "大小刚好合适";
}
}
else {
echo "文件上传失败".$_FILES['myfile']['error'];}
}
}
?>
ps 代码不具备上传文件的功能,是我逐渐删减最后找到问题所在处。我明明上传文件了,依然显示 无任何文件上传。求大神指导。各位大神看看吧。



最后自己稍微自己逐步减代码测试下发现还是那个错误。搞不懂为什么。上图。上代码。我是在手机上测试。
___index.php
<form action="upload.php" method="post" enctype="multipart/form-data" >
name: <input type="text" name="username" value="" /><br>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
up pic: <input type="file" name="myfile" value=""><br>
<input type="submit" value="upload" /><br> </form>
___upload.php
<?php
require "upfile.class.php";
$up = new Uploade;
$up->upfile();
?>
___upfile.class.php
<?php
class Uploade{
function upfile(){
if($_FILES['myfile']['error']=0){
if($_FILES['myfile']['size']<10000000){
echo "大小刚好合适";
}
}
else {
echo "文件上传失败".$_FILES['myfile']['error'];}
}
}
?>
ps 代码不具备上传文件的功能,是我逐渐删减最后找到问题所在处。我明明上传文件了,依然显示 无任何文件上传。求大神指导。各位大神看看吧。


