hey guys
i've been trying to work the uploadify script to little avail... it uploads all the files correctly to the assigned folder but no details of the upload are added via mysql.
any idea of where i may be making a mistake? please help.
manage.php
<script type="text/javascript">
$(document).ready(function() {
$("#uploadify").uploadify({
'uploader' : 'resources/uploadify.swf',
'script' : 'resources/uploadify.php',
'folder' : 'files',
'queueID' : 'fileQueue',
'auto' : true,
'onAllComplete' : function(){ alert("Thank you. All files have been uploaded successfully."); },
'multi' : true
});
});
</script>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] . '?id=' . intval($client_id); ?>">
<p>
<b>File Upload</b></p>
<div id="fileQueue"></div>
<input type="file" name="uploadify" id="uploadify" />
<p><a href="javascript:jQuery('#uploadify').uploadifyClearQueue()" class="form">Cancel all uploads</a></p>
<a href="#viewFiles" class="form" rel="facebox">View files</a>
<div id="viewFiles" style="display:none;" rel="facebox">
<div style="width:300px; height: 300px;"></div>
</div>
</p>
</form>
uploadify.php
<?php require_once('../Connections/speedycms.php);
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
$fileName = $_FILES['uploadify']['name'];
$fileSize = $_FILES['uploadify']['size'];
$fileType = $_FILES['uploadify']['type'];
$client_id = mysql_real_escape_string($_GET['id']);
// $fileTypes = str_replace('*.','',$_REQUEST['fileext']);
// $fileTypes = str_replace(';','|',$fileTypes);
// $typesArray = split('\|',$fileTypes);
// $fileParts = pathinfo($_FILES['Filedata']['name']);
// if (in_array($fileParts['extension'],$typesArray)) {
// Uncomment the following line if you want to make the directory if it doesn't exist
// mkdir(str_replace('//','/',$targetPath), 0755, true);
move_uploaded_file($tempFile,$targetFile);
echo "1";
mysql_query("
INSERT INTO tbl_accidentfiles SET client_id='$client_id', name='${fileName}', path='${targetFile}', size='$fileSize', content_type='${content_type}'");
// } else {
// echo 'Invalid file type.';
// }
}
?>
many thanks!