I am using Uploadify included in an application. Allow me to provide you with a little of background, assistance. I've got a form in which a user can also add "projects" to some website. First they enter in the title from the project along with a description. On submit, this updates a PHP/MySQL database table named "project" and it is given an ID.

The consumer may then upload files to some location around the server. If only to include the project title onto the beginning of the file reputation for upload And also the project ID (which I have to increase the database) before upload starts, when upload completes add the file particulars to some database table "image" - associated with "project" through the project ID.

I understand I am kinda bouncing backwards and forwards a great deal, I have to understand how to do that. Two database tables to update, one on form submit and something on file-upload. I have to pass the project title and ID towards the uploadify upload script.

-----------------------------SOLUTION:

I needed to make use of the below uploadify approach to send the Project ID towards the uploadify script, getting formerly filled variable pid using the mysql_insert_id result:

'onSelectOnce': function(event,data) {
     $('#file_upload').uploadifySettings('scriptData', {'pid': pid});
 }

I possibly could then get the pid variable within the PHP uploadify script utilizing a simple publish:

$pid = $_POST['pid'];

It had been then dependent on managing a choose in this particular script to obtain the data I desired for that database (the project alias) and adding it towards the filename before upload:

    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/' . $alias . '-';
    $targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];

Hopefully this helps people later on.

Cheers

Within the uploadify script there's part that provides the syntax for that file being handled through the upload form. I not have the script available, but uplodify hs a onbefore complete callback as well as an on complete call back features.

make use of the before complete and append the title for an ajax request which will save it for your database, after that just perform 2 queries, upload the title from the image and hang user_id towards the ID from the user thats most likely from ur session.

   var = file_before_upload_name: filename // here use the sytax that Uploadify uses to capture the name of the file
   var = file_after_upload_name: filename // here use the sytax that Uploadify uses to capture the name of the file

after that time the aftercomplete callback make use of an ajax request and hang

uid : uid //from the session before: file_before_upload_title, after : file_after_upload_title

within the ajax your queries would seem like

mysql_queries("INSERT INTO `tbl-projects` SET `user_id` = {$_POST['uid']}, `file` = {$_POST['after']}");

//another query here to set the data to your other table that relates to tbl-projects

I needed to make use of the below uploadify approach to send the Project ID towards the uploadify script, getting formerly filled variable pid using the mysql_place_id result:

'onSelectOnce': function(event,data) {
     $('#file_upload').uploadifySettings('scriptData', {'pid': pid});
 }

I possibly could then get the pid variable within the PHP uploadify script utilizing a simple publish:

$pid = $_POST['pid'];

It had been then dependent on managing a choose in this particular script to obtain the data I desired for that database (the project alias) and adding it towards the filename before upload:

$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/' . $alias . '-';
$targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];

Hopefully this helps people later on.