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'];
If you are using sessions, please check that you have started session i.e session_start()
If you want to pass the post_id from uploadify function to php file, you can use the scriptData, which is mentioned in the below function.
uploadify.php
Try this it should work as you expected
Just encountered this problem. Flash doesn't use the cookies that are set in your browser so you need to pass your session id into the flash script as a post variable and then set the cookie value from the post value in your upload.php script. See:
jQuery and Uploadify session in the php file