It looks like you're new here. If you want to get involved, click one of these buttons!
<input id=\"fileInput\" name=\"fileInput\" type=\"file\" />
<script type=\"text/javascript\">// <![CDATA[
$(document).ready(function() {
$('#fileInput').uploadify({
'uploader' : '/includes/js/uploadify/uploadify.swf',
'script' : '/includes/js/uploadify/uploadify.php?aoiid=<?php echo \"$aoiid\";?>',
'cancelImg' : '/includes/js/uploadify/cancel.png',
'auto' : true,
'folder' : '/aoipdf',
'buttonText' : 'Upload AOI',
'fileDesc' : 'PDF',
'fileExt' : '*.pdf'
});
});
// ]]></script>
include('../../conn.php');
$aoiid = @$_GET['aoiid'];
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
// $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);
mysql_query(\"INSERT INTO aoi WHERE id='$aoiid' (filename) VALUES ('\" . $targetFile . \"');\" );
move_uploaded_file($tempFile,$targetFile);
echo \"1\";
// } else {
// echo 'Invalid file type.';
// }
}
<input id=\"fileInput\" name=\"fileInput\" type=\"file\" />
<script type=\"text/javascript\">// <![CDATA[
$(document).ready(function() {
$('#fileInput').uploadify({
'scriptData' : {'aoiid': '<?= $_GET['aoiid']; ?>'},
'uploader' : '/includes/js/uploadify/uploadify.swf',
'script' : '/includes/js/uploadify/uploadify.php',
'cancelImg' : '/includes/js/uploadify/cancel.png',
'auto' : true,
'folder' : '/aoipdf',
'buttonText' : 'Upload AOI',
'fileDesc' : 'PDF',
'fileExt' : '*.pdf'
});
});
// ]]></script>
include('../../conn.php');
$aoiid = $_REQUEST['aoiid'];
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
// $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);
mysql_query(\"UPDATE aoi SET filename = '\" . $targetFile . \"' WHERE id='$aoiid'\");
move_uploaded_file($tempFile,$targetFile);
echo \"1\";
// } else {
// echo 'Invalid file type.';
// }
}