1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
if($type=='lm')
{ $date_envoi=gmstrftime('%Y-%m-%d %H:%M:%S');//date en gmt date('Y-m-d H:i:s');
$sql="insert into offres_emploi_form (lang, prenom, nom, email, date_envoi) values ('$lang', '$prenom', '$nom', '$email', '$date_envoi')";
$req=mysql_query($sql) or die ("failure save data in DB");
$Ref=mysql_insert_id();
$_SESSION['Ref']=$Ref;
$name_file=$uploaddir ."LM-"."$lang-". $Ref ."-". $_FILES['Filedata']['name'];
$upload=move_uploaded_file($_FILES['Filedata']['tmp_name'], $name_file);
if(!$upload)
$retour='1';
else
{ $sql2="update offres_emploi_form set lm='$name_file' where Ref=$Ref";
$req2=mysql_query($sql2) or die ("failure ajout lm file");
}
}
if($type=='cv')
{ $name_file=$uploaddir ."CV-"."$lang-". $Ref ."-". $_FILES['Filedata']['name'];
$upload=move_uploaded_file($_FILES['Filedata']['tmp_name'], $name_file);
if(!$upload)
$retour='0';
else
{ $sql2="update offres_emploi_form set cv='$name_file' where Ref=".$_SESSION['Ref'];
$req2=mysql_query($sql2) or die ("failure ajout cv file");
}
//$_SESSION= array();
session_destroy(); |
Partager