title: HTML 5 Camera access & upload file using php
body: <p>I am using below code for html 5 camera access and uploading the image to server.</p>
  
  <p>HTML Code </p>
  
  <pre><code>&lt;form action="upload.php" method="post" enctype="multipart/form-data"&gt;
    &lt;input type="file" name="image" accept="image/*" capture&gt;
    &lt;input type="submit" value="Upload"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>upload.php code</p>
  
  <pre><code>&lt;?php 
  $target_path = "upload/";
  
  $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
  
  if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
      echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
      " has been uploaded";
  } else{
      echo "There was an error uploading the file, please try again!";
  }
  ?&gt;
  </code></pre>
  
  <p>Problem is When I am testing the code it's showing "There was an error uploading the file, please try again!" . Can anyone help me to figure it out where the problem ?</p>
  
  <p>Below code is working properly for me.</p>
  
  <p>HTML Code :</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" action="upload.php" method="POST"&gt;
  &lt;input type="hidden" name="MAX_FILE_SIZE" value="100000" /&gt;
  Choose a file to upload: &lt;input name="uploadedfile" type="file" /&gt;&lt;br /&gt;
  &lt;input type="submit" value="Upload File" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>PHP code is same as above.</p>