I'm having problems with uploadify. Whenever I use a string in the $post_id, uploadify only uploads a single file when I've selected 3 files for upload. But when I specify a non-existing value for $post_id such as a session variable that doesn't exist $_SESSION['something']. It inserts all three of the files into the database. I'm thinking that this might be an error on the data structure of $post_id.
if(!empty($_FILES)){
$post_id = 'aa';
$name2 = mysql_real_escape_string($_FILES['Filedata']['name']);
$mime2 = mysql_real_escape_string($_FILES['Filedata']['type']);
$data2 = mysql_real_escape_string(file_get_contents($_FILES['Filedata']['tmp_name']));
$size2 = intval($_FILES['Filedata']['size']);
$db->query("INSERT INTO tbl_files SET post_id='$post_id', filename='$name2', file_data='$data2', mime_type_id='$mime2'");
}
I tried to echo the rest of the data and it seems like they're only storing plain strings. So $post_id string should also work,
echo $_FILES['Filedata']['name'];
Try this it should work as you expected
$tblQry = 'INSERT INTO tbl_files ';
$tblQry .= 'SET
post_id = "' .$_SESSION['post_id'] . '",
filename = "' .$name2. '",
file_data = "' .$data2.'",
mime_type_id = "' .$mime2.'"';
$db->query($tblQry);