I have some code written in JS, i call following line in JS function and it works fine
$('#uploadify_1').uploadifyUpload();
Here is my php file, code
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$filenms = time().$_FILES['Filedata']['name'];
$targetFile = str_replace('//','/',$targetPath) .$filenms;
move_uploaded_file($tempFile,$targetFile);
echo $filenms;
}
I have var id=1; in JS file, I want to pass this variable to my php file, like this
$('#uploadify_1').uploadifyUpload(id);
But it does not work. Please advice me, how can i pass that variable to same php file when it start uploading, so i use ID to update DB, in php file.
Many Thanks
I would say RTM :P
$('#file_upload').uploadify({
// Some options
'method' : 'post',
'formData' : { 'id' : id }
});
Then in your PHP:
$_POST['id']
More: http://www.uploadify.com/documentation/uploadify/customizing-the-server-side-upload-script/