i want to pass other parameters with file to save in database.when i put code to get those variables and save in database it give me alert "SyntaxError: syntax error"... here is my code
$.ajaxFileUpload
({
url:'popup/doc_mydeal.php',
secureuri:false,
fileElementId:'deals_documents',
dataType: 'json',
data:{rand_key: $('#rand_key').val(), document_name: $('#document_name').val()},
success: function (data, status)
{
if(typeof(data.error) != 'undefined')
{
if(data.error != '')
{
alert(data.error);
}
}
},
error: function (data, status, e)
{
alert(e);
}
})
Now on doc_mydeal.php
$tempFile = $_FILES['deals_documents']['tmp_name'];
$targetFile=$path.$_REQUEST['rand_key'].basename($_FILES['deals_documents']['name']);
move_uploaded_file($tempFile,$targetFile);
and here is mysql query to save in database
jsonbut you don't return anything.json_encodefunction rather than trying to generate the correct JSON string yourself.