hi all,
i need to save the uploaded image in some images folder with uploaded date folder and then image like

images/2010-11-01/image.jpg

can any one help me..
i tried this...it is working fine but wat i want is i need to create uploaded date folder and save in that folder..

if(isset($_POST['submit']))
    {
        $date = date("Y/m/d");
        if((!empty($_FILES["imageupload"])) && ($_FILES['imageupload']['error'] == 0)) {
  //Check if the file is JPEG image and it's size is less than 350Kb
  $filename = basename($_FILES['imageupload']['name']);
  $ext = substr($filename, strrpos($filename, '.') + 1);
 // if (($ext == "jpg")) {
    //Determine the path to which we want to save this file
      $newname = dirname(__FILE__).'/images/'.$filename;
      //Check if the file with the same name is already exists on the server
      if (!file_exists($newname)) {
        //Attempt to move the uploaded file to it's new place
        if ((move_uploaded_file($_FILES['imageupload']['tmp_name'],$newname))) {
           echo "The image has been uploaded as: ".$filename;
        } else {
           echo "Error: A problem occurred during images upload!";
        }
      } else {
         echo "Error: image ".$_FILES["uploaded_file"]["name"]." already exists";
      }
 // } else {
  //   echo "Error: Only .jpg images  are accepted for upload";
 // }
} else {
 echo "Error: No image uploaded";
}

i need to get the $date which is in line 3 to line 10. how to make it...

Hi

try this may be this can helps you

$target_path = '/images/'.date('Y-m-d');
if(!is_dir($target_path)){
   mkdir($target_path,0777);	
}
if( !is_writable( $target_path )) {
    chmod($target_path,0777);
}

let me know if this helps you or not

thank u...i got it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.