1
<html>
<form action="image_test.php" enctype="multipart/form-data" method="post">
    <table style="border-collapse: collapse; font: 12px Tahoma;" border="1" cellspacing="5" cellpadding="5">
        <tbody>
            <tr>
                <td><img src="digital.jpg" name="image1"></td>
            </tr>
            <tr>
                <td><input name="Upload Now" type="submit" value="Upload Image"></td>
            </tr>
        </tbody>
    </table>
</form>
<html>
<?php
header('Content-type: image/jpg');
print "<pre>".print_r($_FILES,1)."</pre>";
$file=$_FILES['image1']['tmp_name'];
?>

How do I retrieve the image in php to then upload it later. This is important as I am getting the image from my webcam

Shaam
  • 92
  • 13

2 Answers2

1

You can draw captured image from webcam into canvas and then send canvas image data to PHP server via ajax by method getImageData.

Community
  • 1
  • 1
Olim Saidov
  • 2,796
  • 1
  • 25
  • 32
0

I could not understand what you are doing here , first you create an html form ok then you start a session and sending Content type header, that is complelety stupid, header must be send first, other wise you can face "Header all ready send Error", then the main thing is that you set the content type to image/jpg but seding html data, :o ?

I think what you want is :

you want that tag image on server, but it seems that file is already on server ? O.o ,, or it may be any other server ?

If it is one the same server then you can do like this :-

 <td>
   <img src="digital.jpg" name="image1">
   <input type="hidden" name="file_location" value="digital.jpg">
</td>

Then you can check on server like this :-

if(isset($_GET['file_location'])){

   if(file_exists($_GET['file_location'])){

        // process on image
        // if image is remote, then you can use file_get_contents('') { remote must be allowed in php.ini } 

   }  // exists

} // 

And Last line :- It is completely stupid Code and you must find other way to solve your problem :) ,, Thanks

Tiger
  • 404
  • 1
  • 4
  • 13