title: Saving jpegcam plugin photo to server (snapshot)
body: <p>I'm trying to implement a webcam "plugin" on my site. I have searched a lot and find some options:</p>
  
  <ul>
  <li>jquery webcan plugin</li>
  <li>Jpeg cam plugin
  -jquery webcam (from Mackers Mcmackers)</li>
  </ul>
  
  <p>But the only one where I see a live example where I can take a snapshot and automatic save it (and show) to the server is jpeg cam: <a href="http://bowser.effectgames.com/~jhuckaby/jpegcam/stealth.html" rel="nofollow">live example</a>.</p>
  
  <p>It's downloads pack comes with a PHP example to save the image to the server:</p>
  
  <pre><code>&lt;?php
  
  /* JPEGCam Test Script */
  /* Receives JPEG webcam submission and saves to local file. */
  /* Make sure your directory has permission to write files as your web server user! */
  
  $filename = date('YmdHis') . '.jpg';
  $result = file_put_contents( $filename, file_get_contents('php://input') );
  if (!$result) {
      print "ERROR: Failed to write data to $filename, check permissions\n";
      exit();
  }
  
  $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/' . $filename;
  print "$url\n";
  
  ?&gt;
  </code></pre>
  
  <p>When running on local, it wont save the image. I'm guessing it should work on server, but while on local it at least shows the uploading text and uploading confirmation, in the server it`s like it wont start the test.php.</p>
  
  <p>Heres the saving options (on .html) in jquery:</p>
  
  <pre><code>&lt;script language="JavaScript"&gt;
          webcam.set_hook( 'onComplete', 'my_completion_handler' );
  
          function take_snapshot() {
              // take snapshot and upload to server
              // document.getElementById('upload_results').innerHTML = '&lt;h1&gt;Uploading...&lt;/h1&gt;';
              webcam.snap();
          }
  
          function my_completion_handler(msg) {
              // extract URL out of PHP output
              if (msg.match(/(http\:\/\/\S+)/)) {
                  var image_url = RegExp.$1;
                  // show JPEG image in page
                  document.getElementById('upload_results').innerHTML = 
                      '&lt;h1&gt;Upload Successful!&lt;/h1&gt;' + 
                      '&lt;h3&gt;JPEG URL: ' + image_url + '&lt;/h3&gt;' + 
                      '&lt;img src="' + image_url + '"&gt;';
              }
              else alert("PHP Error: " + msg);
          }
      &lt;/script&gt;
  </code></pre>
  
  <p>and the part where you point to the .php that will receive the photo (part of the plugging API):    </p>
  
  <pre><code>&lt;script language="JavaScript"&gt;
          webcam.set_api_url( 'test.php' );
          webcam.set_quality( 90 ); // JPEG quality (1 - 100)
          webcam.set_shutter_sound( false ); // no shutter click sound
          webcam.set_stealth( true ); // enable stealth mode
      &lt;/script&gt;
  </code></pre>
  
  <p>Can someone help me please? Thanks in advance!</p>