$('#formalta').submit(function (event) {
event.preventDefault();
var formulario = $('#formalta');
var datos = formulario.serialize();
var archivos = new FormData();
var url = 'funciones/alta.php';
$.ajax({
url: url + '?' + datos,
type: 'POST',
contentType: false,
data: archivos,
processData: false,
success: function (data) { Hace algo cuando funciona. },
error: function (xhr, ajaxOptions,thrownError) {
alert(thrownError);}
});//ajax-PDF
});//submit
Código ajax $('#formalta').submit(function (event) {
event.preventDefault();
var formulario = $('#formalta');
var datos = formulario.serialize();
var archivos = new FormData();
var url = 'funciones/alta.php';
$.ajax({
url: url + '?' + datos,
type: 'POST',
contentType: false,
data: archivos,
processData: false,
success: function (data) { Hace algo cuando funciona. },
error: function (xhr, ajaxOptions,thrownError) {
alert(thrownError);}
});//ajax-PDF
});//submit
$m=$db->lastInsertId();
if($_FILES['pdfFile']['name']!= ''){
if ($_FILES['pdfFile']['type']!="application/pdf."){
$extension = strrchr($_FILES['pdfFile']['name'],'.' );
$_FILES['pdfFile']['name']=$m.''.$extension;
$serverPath='../../TTS/pages/calibration/files';
$tempPath=$_FILES['pdfFile']['tmp_name'];
$fileName= $_FILES['pdfFile']['name'];
$format = $_FILES['pdfFile']['type'];
$destiny=$serverPath.'/'.$fileName;
$bdPath='files'.'/'.$fileName;
$queryUpdate="UPDATE calibrationtbltemp SET pdf='$bdPath' where id=$m";
$queryUpdateEx=$db->runQuery($queryUpdate) or die("no se ejecuto");
if($queryUpdateEx){
$resultado = copy($_FILES["pdfFile"]["tmp_name"], $destiny);
}//if queryUpdateEx
}//if type is not application/pdf
} //empty
echo $m;
Código PHP $m=$db->lastInsertId();
if($_FILES['pdfFile']['name']!= ''){
if ($_FILES['pdfFile']['type']!="application/pdf."){
$extension = strrchr($_FILES['pdfFile']['name'],'.' );
$_FILES['pdfFile']['name']=$m.''.$extension;
$serverPath='../../TTS/pages/calibration/files';
$tempPath=$_FILES['pdfFile']['tmp_name'];
$fileName= $_FILES['pdfFile']['name'];
$format = $_FILES['pdfFile']['type'];
$destiny=$serverPath.'/'.$fileName;
$bdPath='files'.'/'.$fileName;
$queryUpdate="UPDATE calibrationtbltemp SET pdf='$bdPath' where id=$m";
$queryUpdateEx=$db->runQuery($queryUpdate) or die("no se ejecuto");
if($queryUpdateEx){
$resultado = copy($_FILES["pdfFile"]["tmp_name"], $destiny);
}//if queryUpdateEx
}//if type is not application/pdf
} //empty
echo $m;
El error que obtengo es:
Notice: Undefined index: pdfFile in
C:\wamp\www\Calibration\funciones\alta.php on line 27