安卓&ios网页打开摄像头


<html>

  <head>
    <meta name="viewport" content="width=device-width; initial-scale=1.0; minimum-scale=1.0; maximum-scale=1.0" />
    <style type="text/css">#testButton { color:rgb(255, 255, 255);font-size:14px;padding-top:56px;padding-bottom:56px;padding-left:50px;padding-right:50px;border-width:9px;border-color:rgb(197, 229, 145);border-style:solid;border-radius:49px;background-color:rgb(120, 195, 0);}#testButton:hover{color:#ffffff;background-color:#78c300;border-color:#c5e591;}</style>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
  </head>

  <body scroll="no">
   <form action="up.php" method="post"
enctype="multipart/form-data">

    <input style="display:none" type="file" capture="camera" accept="image/*" id="cameraInput" name="file" onchange="subm()"/>
    <button id="testButton" type="button">intehel</button>
     <button id="sb" style="display:none"></button>
      </form></body>
  <script language="javascript">
    $("#testButton").click(function() {
      $("#cameraInput").click()
    });
 function subm(){
    $("#sb").click()
 }
  </script>

</html>
<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 90000000))
  {
  $img_name=  rand(0,999999). "_" .$_FILES["file"]["name"];
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " .$img_name . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    echo "<img src='http://img.pee.cx/" .$img_name. "'>";
    if (file_exists("upload/" . $img_name))
      {
      echo $img_name . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "upload/" . $img_name);
      echo "Stored in: " . "upload/" . $img_name;
      }
    }
  }
else
  {
  echo "Invalid file";
  }
?>
Last modification:February 1st, 2018 at 06:23 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment