$iferev = "IfeReverso_";
$ifefrontal = "IfeFrontal_";
$domicilio = "ComprobanteDomicilio_";
// File upload Ifevuelta
$targetDir = "uploads/";
$fileName = basename($_FILES["Ifevuelta"]["name"]);
$ext = end(explode('.', $_FILES["Ifevuelta"]["name"]));
$name = $iferev. $_SESSION['user']. '.' . $ext;
$new_name = "uploads/". $_SESSION['user'] .".pdf";
$targetFilePath = $targetDir . $name;
$fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION);
// File upload Ife/";
$fileName1 = basename($_FILES["Ife"]["name"]);
$ext1= end(explode('.', $_FILES["Ife"]["name"]));
$name1 = $ifefrontal. $_SESSION['user']. '.' . $ext1;
$targetFilePath1 = $targetDir . $name1;
$fileType1 = pathinfo($targetFilePath1,PATHINFO_EXTENSION);
// File upload Domicilio/";
$fileName2 = basename($_FILES["Domicilio"]["name"]);
$ext2= end(explode('.', $_FILES["Domicilio"]["name"]));
$name2 = $domicilio. $_SESSION['user']. '.' . $ext2;
$targetFilePath2 = $targetDir . $name2;
$fileType2 = pathinfo($targetFilePath2,PATHINFO_EXTENSION);
if($_SERVER["REQUEST_METHOD"] == "POST") {
// username and password sent from form
$allowTypes = array('jpg','png','jpeg','gif','pdf');
if(in_array($fileType, $allowTypes)){
// Upload file to server
if(move_uploaded_file($_FILES["Ifevuelta"]["tmp_name"], $targetFilePath)){
// Insert image file name into database
$insert="UPDATE Usuarios SET ifevuelta = '$targetFilePath' Where user = '" . $_SESSION['user'] . "'";
$result8 = mysqli_query($conexion,$insert);
if($insert){
$statusMsg = "The file ".$fileName. " has been uploaded successfully.";
}else{
$statusMsg = "File upload failed, please try again.";
}
}else{
$statusMsg = "Sorry, there was an error uploading your file.";
}
}else{
$statusMsg = 'Sorry, only JPG, JPEG, PNG, GIF, & PDF files are allowed to upload.';
}
// Display status message
echo "Tipo de Archivo: $targetFilePath";
echo $statusMsg;
$allowTypes = array('jpg','png','jpeg','gif','pdf');
if(in_array($fileType1, $allowTypes)){
// Upload file to server
if(move_uploaded_file($_FILES["Ife"]["tmp_name"], $targetFilePath1)){
// Insert image file name into database
$insert1="UPDATE Usuarios SET IFE = '$targetFilePath1' Where user = '" . $_SESSION['user'] . "'";
$result9 = mysqli_query($conexion,$insert1);
if($insert1){
$statusMsg1 = "The file ".$fileName1. " has been uploaded successfully.";
}else{
$statusMsg1 = "File upload failed, please try again.";
}
}else{
$statusMsg1 = "Sorry, there was an error uploading your file.";
}
}else{
$statusMsg1 = 'Sorry, only JPG, JPEG, PNG, GIF, & PDF files are allowed to upload.';
}
// Display status message
echo "Consulta IFE: $result9";
echo $statusMsg1;
$allowTypes = array('jpg','png','jpeg','gif','pdf');
if(in_array($fileType2, $allowTypes)){
// Upload file to server
if(move_uploaded_file($_FILES["Domicilio"]["tmp_name"], $targetFilePath2)){
// Insert image file name into database
$insert2="UPDATE Usuarios SET ComprobanteDomicilio = '$targetFilePath2' Where user = '" . $_SESSION['user'] . "'";
$result10 = mysqli_query($conexion,$insert2);
if($insert2){
$statusMsg2 = "The file ".$fileName2. " has been uploaded successfully.";
}else{
$statusMsg2 = "File upload failed, please try again.";
}
}else{
$statusMsg2 = "Sorry, there was an error uploading your file.";
}
}else{
$statusMsg2 = 'Sorry, only JPG, JPEG, PNG, GIF, & PDF files are allowed to upload.';
}
// Display status message
echo $statusMsg2;