Heim >Backend-Entwicklung >PHP-Tutorial >求大神帮看下这段代码 ,上传图片顺利,但是找不到图片
求大神帮看下这段代码 ,上传图片成功,但是找不到图片?
<br /><!DOCTYPE html><br /><html><br /> <head><br /> <title>Test the input</title><br /> </head><br /> <body><br /> <form action="upload.php" method="post" enctype="multipart/form-data"><br /> <label for="picture">PICTURE:</label><br /><br /> <input type="file" name="picture" id="picture"/><br/><br /> <input type="submit" name="submit" value="submit"/><br /> </form><br /> </body><br /></html><br />
<br /><?php<br /> $photo_dir='/var/www/images/';<br /> if(!is_dir($photo_dir)||is_writeable($photo_dir)){<br /> die('No dir exist or can write');<br /> }<br /> if($_FILES['picture']['error']>0){<br /> echo 'Error:'.$_FILES['picture']['error'].'<br/>';<br /> }<br /> else{<br /> echo "Upload:".$_FILES['picture']['name'].'<br />';<br /> echo "Type:".$_FILES['picture']['type'].'<br />';<br /> echo "Size:".($_FILES['picture']['size']/1024).'kb<br/>';<br /> echo "Stred in:".$_FILES['picture']['tmp_name'].'<br />';<br /> if(file_exists('/var/www/images/'.$_FILES['picture']['name']))<br /> {<br /> echo $_FILES['picture']['name'].'already exists';<br /> }<br /> else<br /> {<br /> $gpy=move_uploaded_file($_FILES['picture']['tmp_name'],'/var/www/images/'.$_FILES['picture']['name']);<br /> if(gpy)<br /> {<br /> echo 'Succed';<br /> }<br /> echo 'Stored in:'.'images/'.$_FILES['picture']['name'];<br /> }<br /> }<br /><br />?><br /><br />