I have made a flash webcam application to allow the user to take a photo of themselves using a webcam. I have successfully saved the photo in my localhost. However, I would like to set the names of those photos. Currently, the photos names are generated by
$uniqueStamp = date('U');
I also have a textfield in my flash app that allows inputs from user for the photo name. For example if the user write 'MYPHOTONAME' in the textfield, the photo which will be saved in my localhost will be named 'MYPHOTONAME' too. How do I do it in Flash and in PHP? Currently I'm having some problems because I cannot send the textfield string to PHP.
Here is my flash code to send the snapshot to PHP and let the PHP save it in my localhost:
imgBA = jpgEncoder.encode(imgBD1);
sendReq.data = imgBA;
sendLoader.load(sendReq);
Here is my PHP code:
if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) {
$photo = $_POST['photo'];
$uniqueStamp = date('U');
$filename = $photo.$uniqueStamp.".jpg";
$fp = fopen( 'photos/'.$filename,"wb");
fwrite( $fp, $GLOBALS[ 'HTTP_RAW_POST_DATA' ] );
fclose( $fp );
echo 'filename=photos/'.$filename."&base=".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"]);
}
As you can see, I tried to pass in $photo = $_POST['photo']; from flash to PHP however I do not know the exact code, can anyone help me?