开发者

PHP Image Upload, with preview on select of a file

Ok so im making an image uploader with a chance to see what you are going to upload, before entering it into the database. My mind is kinda tired, could you please just get me through this one? thx (btw it doesnt work :p) Its on a clean page, i 开发者_运维知识库choose a file from my pictures on compouter, it doesn echo "hi wazzup

   <?php 
 if(isset($_FILES['image'])){
 echo "hi wazzup!";

}

 ?> 

<form name="form" id="form" method="post" enctype="multipart/form-data"  action="<?php echo $_SERVER['PHP_SELF']; ?>" >
<input type="file" name="image" onChange="if(event.propertyName=='value') {document.getElementById("form").submit();}">
</form>


See what is the output and you will know wheater your javascript is wrong or you should use $_FILES instead of $_POST for image

<?php
if(isset($_POST))
{
   if(isset($_FILES['image'])){
      echo "<span style=\"z-index:1000;display:block;\">hi wazzup!</span>";
    }
echo "POSTED";
}
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜