Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

save image same with the value of the form

images php coding issues or problems here.

Moderators: macek, egami, gesf

save image same with the value of the form

Postby jpcatherine » Tue Feb 14, 2012 11:53 pm

hi guys.
can you please help me here
I want save an image but the file name should be same with the value name of the form
here is my code

Code: Select all
            <form name="webcam_buttons" method="GET" action="test.php">
                <span><p>ID number</p><input type="textbox" value='<?php echo $id_number; ?>' name="id_number2"></input></span>
    <!--                <input type=button value="Configure..." onClick="webcam.configure()">-->
                &nbsp;&nbsp;&nbsp;
                <input type="Submit" value="Capture" onClick="webcam.snap()">
                &nbsp;&nbsp;&nbsp;
    <!--            <input type=button value="Reset" onClick="webcam.reset()"> -->
            </form>



Code: Select all
<?php

require_once 'post_id.php';

$id_number = ($_REQUEST['id_number2']) . '.jpg';

//$filename = date('YmdHis') . '.jpg';
$filename = $id_number;
$result = file_put_contents($filename, file_get_contents('php://input'));
if (!$result) {
    echo "Can't save image $filename \n";
    exit();
}

$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/' . $filename;
print "$url\n";
?>
jpcatherine
New php-forum User
New php-forum User
 
Posts: 1
Joined: Tue Feb 14, 2012 11:48 pm

Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.