Wednesday, July 21, 2010

PHP - Upload the files (1 of the best way)

$save_path="images\\";
$file = $_FILES['image'];// changed the $_POST['Resume'] to $_FILES['Resume']
$filenaemNew = "";
if($file !="" && $file['name']!="")
//Added the $file['name']!="" part check file field is blank
{

if(isset($save_path) && $save_path!="")
{
$name = split('/',$file['name']);
$filenaemNew = date("y").date("m").date("j").date("G").date("i").$file['name'];
move_uploaded_file($file['tmp_name'], $save_path . $filenaemNew);

}
else
{
$filenaemNew = "";
}

}
else
{
$filenaemNew = "";
}

No comments:

Post a Comment