The sequence number for $filename
Posted: Wed Oct 16, 2013 11:17 pm
Hi everyone, in the last few days, I tried to used Flash and PHP to make a program that can take photos with webcam and upload the photos into server folder.
Inside my php code "$filename = "images1/visualstudio". mktime(). ".jpg";" is the reference I found online, I understand the "mktime()" was generating the combination of date and time,but what I really need is when the photos that upload to folder will be name with sequence number like: "visualstudio01.jpg","visualstudio02.jpg","visualstudio03.jpg"...
Because this is the first time I deal with PHP, from my logic, the code should be "$filename = "images/visualstudio".SEQUENCE NUMBER CODE.".jpg";", but the problem is I don't know how the "SEQUENCE NUMBER CODE" structure should look like, can anyone give me some suggestion or some references?
And here is my php code:
---------------------------------------------------------------------------------------
Inside my php code "$filename = "images1/visualstudio". mktime(). ".jpg";" is the reference I found online, I understand the "mktime()" was generating the combination of date and time,but what I really need is when the photos that upload to folder will be name with sequence number like: "visualstudio01.jpg","visualstudio02.jpg","visualstudio03.jpg"...
Because this is the first time I deal with PHP, from my logic, the code should be "$filename = "images/visualstudio".SEQUENCE NUMBER CODE.".jpg";", but the problem is I don't know how the "SEQUENCE NUMBER CODE" structure should look like, can anyone give me some suggestion or some references?
And here is my php code:
---------------------------------------------------------------------------------------
Code: Select all
[/b]
---------------------------------------------------------------------------------------
<?php
//Now get the encoded image form flash through HTTP_RAW_POST_DATA
if(isset($GLOBALS["HTTP_RAW_POST_DATA"])){
$jpg = $GLOBALS["HTTP_RAW_POST_DATA"];
$img = $_GET["img"];
//image Directory
$filename = "images1/visualstudio". mktime(). ".jpg";
file_put_contents($filename, $jpg);
} else{
//show error if image is not recived
echo "Encoded JPEG information not received.";
}
?>
---------------------------------------------------------------------------------------
[b][/PHP CODE][/b]
---------------------------------------------------------------------------------------
Thanks for your time !! :)