Jump to content


New Members
  • Posts

  • Joined

  • Last visited


Profile Information

  • Gender
    Not Telling

saran_singh's Achievements


Newbie (1/5)



  1. Thanks to reply everyone... I uploaded snapshots in folder upload and into mysql. Following are the code $target = 'upload/'; $filename = $target . 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();} $dbconn = mysql_connect("localhost", "root", "") or die(mysql_error()) ; mysql_select_db("jpegcam") or die(mysql_error()) ; //Writes the information to the database mysql_query("INSERT INTO 'image' VALUES ('$pic')") ; mysql_close($dbconn); ?> The link of snapshots stored successfully in mysql.Now prpblem is how to retrieve it. For retrieve image i written following code:- <?php $dbconn= mysql_connect("localhost", "root", "") or die(mysql_error()) ; mysql_select_db("employees") or die(mysql_error()) ; //Retrieves data from MySQL $data = mysql_query("SELECT `img` FROM employees") or die(mysql_error()); //Puts it into an array while($info = mysql_fetch_array( $data )) { //Outputs the image and other data //Echo "<img src=http://www.yoursite.com/images/".$info['photo'] ."> <br>"; Echo "<img src=http://localhost/file_upload_new/images/".$info['photo'] ." width=\"200\" height=\"200\"> <br>"; mysql_close($dbconn); ?> in this code i can't use ['photo'] because in form photo name was not available. please understand what i m trying to say. i already paste the code of form(test.html).
  2. I am using wampserver 2.2 on window 7 64 bit machine. I am using jpegcam to take snapshots and it works fine. I make upload folder within jpegcam/htdocs/upload to store snapshots. All works fine but how can i store uploaded images into mysql. I also want to retrieve image from mysql and print in php page. The problem is jpegcam used java script in form in which POST method and type file was not used. I am already done task like upload images to folder and store it into mysql using POST an $_FILES varibales . here the code of in jpegcam/htocs/test.html <form name="f1" enctype="multipart/form-data" method="" action="" > <input type=button value="Configure..." onClick="webcam.configure()"> <!-- <input type=button name="img" value="Take Snapshot" onClick="take_snapshot()"> --> <a href="javascript:void(webcam.freeze())">Freeze</a> <a href="javascript:void(webcam.upload())">Upload</a> <a href="javascript:void(webcam.reset())">Reset</a> </form> and this the code of jpegcam/htocs/test.php $target = 'upload/'; $filename = $target . 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(); } Now please tell me how can i store snapshots in mysql an retrieve it an print it in another php page.please plzplz help me as soon as possibe. please please... Thanks in advance.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.