It looks like you're new here. If you want to get involved, click one of these buttons!
$(document).ready(function() {
$(\"#uploadify\").uploadify({
'uploader' : 'jscripts/uploadify/uploadify.swf',
'script' : 'includes/fileUploader2.php',
'checkScript' : 'includes/checkFiles.php?s=<?=base64_encode($s)?>',
'cancelImg' : 'jscripts/uploadify/cancel.png',
'folder' : '',
'fileDesc' : 'Select Files',
'fileExt' : '<? if(!empty($rwE['fileExt'])){
foreach($exts as $value){
echo \"*\".$value.\";\";
}
}else{
echo \".\";
}?>',
'buttonText' : 'Select Files',
'scriptData' : {'subCompId':'<?=base64_encode($s)?>', 'compID':'<?=$_SESSION['ql_compID']?>'},
'queueID' : 'fileQueue',
'auto' : true,
'multi' : true,
'sizeLimit' : '1038860800',
'simUploadLimit': '2',
'onComplete' : function(event, queueID, fileObj, response, data){
if(response != '1'){
$('<div>'+fileObj.name+ 'Upload failed! '+response+'</div>').appendTo('#upErrors').addClass('alert');
}
else{
$('<div>'+fileObj.name+' Upload successful</div>').appendTo('#upErrors').addClass('greenOk');
}
},
'onError' : function (a, b, c, d) {
if (d.status == 404)
alert('Could not find upload script. Use a path relative to: '+'<?= getcwd() ?>');
else if (d.type === \"HTTP\")
alert('error '+d.type+\": \"+d.info);
else if (d.type ===\"File Size\")
alert(c.name+' '+d.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB');
else
alert('error '+d.type+\": \"+d.info);
}
});
});
<?
require_once(\"conn.php\");
/*** Protect Variables from SQL injection ***/
function cv($value){
// Stripslashes
if (get_magic_quotes_gpc()){
$value = stripslashes($value);
}
// Quote if not a number
if (!is_numeric($value)){
$value = \"'\" . mysql_real_escape_string($value) . \"'\";
}
return $value;
}
/*** format the stoage number ie kb mb ***/
function theSize($size){
$setTxt = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
$e = floor(log($size)/log(1024));
$output = @sprintf('%.2f '.$setTxt[$e], ($size/pow(1024, floor($e))));
return $output;
}
/*** Get relevant company details ***/
function compInf($id,$col){
$rs = mysql_query(\"SELECT \".$col.\" FROM comp WHERE compID = \".cv($id).\" LIMIT 1\");
$rw = mysql_fetch_assoc($rs);
return $rw[$col];
mysql_free_result($rs);
}
/*** See if master comp is an sub of comp being uploaded to ***/
function scomp($theCompID,$theSubCompID){
$rs = mysql_query(\"SELECT * FROM compRel WHERE compId = \".cv($theCompID).\" AND subCompId = \".cv($theSubCompID).\" AND apprv = '1' \");
if(mysql_num_rows($rs)){
return true;
}else{
return false;
}
mysql_free_result($rs);
}
/*** Set decoded variable ***/
$sCompID = base64_decode($_POST['subCompId']);
if (!empty($_FILES)) {
/*** Get file information ***/
$tempFile = $_FILES['Filedata']['tmp_name'];//temp file name
$targetPath = '../ql_uploads/'.compInf($sCompID,'compFolder').'/';//path to company folder being uploaded to
$ext = pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION);//get extention of file
$ext = strtolower($ext);//make extention lower case to allow uppercase uploades
/*** Create unidue file name ***/
$fileName = uniqid(\"\").\".\".$ext;
$targetFile = str_replace('//','/',$targetPath) . $fileName;//attach filename to relevant path
/*** Check that the file ext is approved ***/
$fileTypes = str_replace('*.','',$_REQUEST['fileext']);
$fileTypes = str_replace(';','|',$fileTypes);
$typesArray = split('\|',$fileTypes);
$fileParts = pathinfo($_FILES['Filedata']['name']);
/*** Move uploaded file and write to DB ***/
if(move_uploaded_file($tempFile,$targetFile)){
$up = \"INSERT INTO files VALUES ('',\".cv($fileName).\",\".cv($_FILES['Filedata']['name']).\",\".cv($_FILES[\"Filedata\"][\"size\"]).\",NOW(),'',\".cv($sCompID).\",\".cv(compInf($sCompID,'compName')).\",\".cv($_POST['compID']).\",\".cv(compInf($_POST['compID'],'compName')).\")\";
$rsU = mysql_query($up,$admin);
}
}
/*** Some Error checking ***/
switch ($_FILES['Filedata']['error']){
case 0:
// $msg = \"No Error\"; // comment this out if you don't want a message to appear on success.
break;
case 1:
$msg = \"The file is bigger than this PHP installation allows\";
break;
case 2:
$msg = \"The file is bigger than this form allows\";
break;
case 3:
$msg = \"Only part of the file was uploaded\";
break;
case 4:
$msg = \"No file was uploaded\";
break;
case 6:
$msg = \"Missing a temporary folder\";
break;
case 7:
$msg = \"Failed to write file to disk\";
break;
case 8:
$msg = \"File upload stopped by extension\";
break;
default:
$msg = \"unknown error \".$_FILES['Filedata']['error'];
break;
}
if($msg){
$stringData = \"Error: \".$_FILES['Filedata']['error'].\" Error Info: \".$msg;
mail(\"[email protected]\",\"Upload debug\",$stringData);
}else{
$stringData = \"1\"; // This is required for onComplete to fire on Mac OSX
echo $stringData;
}
?>
TravisN. said:It's unfortunate, but as you've found error #2038 is a general error that flash throws when it can't find anywhere else to put it's error.
Off the top of my head I would try
[list]Try a straight upload script without all the extra functions and processing
To test if it's your server/network install XAMPP on a local machine and try your web pages/scripts locally[/list:u]
<?
require_once(\"conn.php\");
/*** Set decoded variable ***/
$sCompID = base64_decode($_POST['subCompId']);
if (!empty($_FILES)) {
/*** Get file information ***/
$tempFile = $_FILES['Filedata']['tmp_name'];//temp file name
$targetPath = '../ql_uploads/Har4b69d8c74d949/';//path to company folder being uploaded to
$ext = pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION);//get extention of file
$ext = strtolower($ext);//make extention lower case to allow uppercase uploades
/*** Create unidue file name ***/
$fileName = uniqid(\"\").\".\".$ext;
$targetFile = str_replace('//','/',$targetPath) . $fileName;//attach filename to relevant path
if(move_uploaded_file($tempFile,$targetFile)){
}
}
/*** Some Error checking ***/
switch ($_FILES['Filedata']['error']){
case 0:
// $msg = \"No Error\"; // comment this out if you don't want a message to appear on success.
break;
case 1:
$msg = \"The file is bigger than this PHP installation allows\";
break;
case 2:
$msg = \"The file is bigger than this form allows\";
break;
case 3:
$msg = \"Only part of the file was uploaded\";
break;
case 4:
$msg = \"No file was uploaded\";
break;
case 6:
$msg = \"Missing a temporary folder\";
break;
case 7:
$msg = \"Failed to write file to disk\";
break;
case 8:
$msg = \"File upload stopped by extension\";
break;
default:
$msg = \"unknown error \".$_FILES['Filedata']['error'];
break;
}
if($msg){
$stringData = \"Error: \".$_FILES['Filedata']['error'].\" Error Info: \".$msg;
mail(\"[email protected]\",\"Quickload debug\",$stringData);
}else{
$stringData = \"1\"; // This is required for onComplete to fire on Mac OSX
echo $stringData;
}
?>