How to add Date and Time in Uploaded Image.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
manojsemwal1
Forum Contributor
Posts: 217
Joined: Mon Jun 29, 2009 4:13 am
Location: India

How to add Date and Time in Uploaded Image.

Post by manojsemwal1 »

Hai friend anybody know that how to add date and time to uploaded image
my script are like:

Code: Select all

 
                $path= move_uploaded_file($_FILES["file"]["tmp_name"],
              "upload/" . $_FILES["file"]["name"]);
              //echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
              $path="upload/" . $_FILES["file"]["name"];
              echo "manoj".$path;
 
here where we have to add date and time.

regards,
Manoj
Last edited by Benjamin on Tue Jun 30, 2009 10:43 am, edited 1 time in total.
Reason: Added [code=php] tags.
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: How to add Date and Time in Uploaded Image.

Post by Eric! »

What do you want to add the date and time to?

You can get the files information using filemtime

Code: Select all

if (file_exists ($file))
      {
        $time = filemtime ($file);
        $year = date ("Y", $time);
        $month = date ("m", $time);
        $day = date ("d", $time);
        $hour = date ("H", $time);
        $minutes = date ("i", $time);
        $seconds = date ("s", $time);
 
        echo $year . $month . $day . '_' . $hour . $minutes . $seconds . "\n";
      }
manojsemwal1
Forum Contributor
Posts: 217
Joined: Mon Jun 29, 2009 4:13 am
Location: India

how to rename file while uploading in the server

Post by manojsemwal1 »

pl tell me how te rename file while uploading in the server......
Post Reply