It looks like you're new here. If you want to get involved, click one of these buttons!
<?php session_start();
$_SESSION['COMMENT_ID'] = '33';
?>
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<link rel=\"stylesheet\" type=\"text/css\" href=\"css/uploadify.css\" />
<script type=\"text/javascript\" src=\"js/jquery-1.3.2.min.js\"></script>
<script type=\"text/javascript\" src=\"js/jquery.uploadify.js\"></script>
<script type=\"text/javascript\">
$(document).ready(function() {
$('#theuploadfield').fileUpload({
'uploader': 'flash/uploader.swf',
'script': 'upload.php',
'folder': './uploads',
'displayData': 'percentage',
'buttonText': 'Choose File(s)',
'buttonImg':'img/butupload.gif',
'width': 172,
'height': 84,
'multi': true,
'scriptData': {'COMMENT_ID': '<?php echo $_SESSION['COMMENT_ID']; ?>'},
'cancelImg': 'img/cancel.png'
});
});
</script>
<title>Upload test</title>
</head>
<body>
<input type=\"file\" id=\"theuploadfield\" name=\"theuploadfield\" /><br />
<div id=\"toolbar\">
<img src=\"img/add.png\" alt=\"Add\" class=\"aligned\" /> <a href=\"javascript:$('#theuploadfield').fileUploadStart();\">Upload Files</a> |
<img src=\"img/cancel_all.png\" alt=\"Cancel\" class=\"aligned\" /> <a href=\"javascript:$('#theuploadfield').fileUploadClearQueue();\">Clear Queue</a>
</div>
</body>
</html>
<?php
require(\"classes/db.class.php\");
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$ext = strtolower(substr($_FILES['Filedata']['name'], strrpos($_FILES['Filedata']['name'], '.') + 1));
//$filename = md5(basename($_FILES['Filedata']['tmp_name'])).'.'.$ext;
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
//upload
move_uploaded_file($tempFile,$targetFile);
$thefilename = $_FILES['Filedata']['name'];
//assign script data to a variable
$theID = $_GET['COMMENT_ID'];
//save file to db
$db = new mysqldb();
$db->select_db();
$sql = sprintf(\"INSERT INTO rob_files (fileName, fileExtension, DateTimeUploaded, CommentID) VALUES ('%s','%s', NOW(), '%s')\",
mysql_real_escape_string($thefilename),
mysql_real_escape_string($ext),
mysql_real_escape_string($theID)
);
$result = $db->query($sql);
$db->kill();
}
//Would un-set the session here usually, but need to use the comment id for when a user actually posts the comment.
//unset($_SESSION['COMMENT_ID']);
echo \"1\";
?>


I want to display a confirmation message after uploading E.g. "3 files uploaded!", but can't figure it out, if anyone could make some suggestions it would be great
onComplete : function(event, queueID, fileObj, reposnse, data) {
document.getElementById('fileUploaded').style.display = 'block';
}
onComplete : function(event, queueID, fileObj, response, data) {
$('#fileUploaded').html(data.filesUploaded + ' files were successfully uploaded.');
$('#fileUploaded').show().animate({'display':'block'},3000).hide(500);
}
tomreno said:rallport,
That directory lister you have looks really nice - would you mind sharing?
<?php
// Uploadify v1.6.2
// Copyright (C) 2009 by Ronnie Garcia
// Co-developed by Travis Nickels
include('config/config.php');
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
//upload
move_uploaded_file($tempFile,$targetFile);
$thefilename = $_FILES['Filedata']['name'];
//save file to db
$sql = sprintf("INSERT INTO tblrequisition (rs_file) VALUES ('%s')", mysql_real_escape_string($thefilename));
$query = mysql_query($sql);
}
echo "1";
?>