X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=admin%2Fattachments.php;h=421c040662f5fa309a25f51a4009149c72c58ab1;hb=6bcd87642330092910f5d6977845a76ac59350ac;hp=639fbd9fdb985eae6443d8cd84ba5a4b9fb716a8;hpb=06a878fac8f2aa889ee481a22bc9f68fef1f7c8b;p=fa-stable.git diff --git a/admin/attachments.php b/admin/attachments.php index 639fbd9f..421c0406 100644 --- a/admin/attachments.php +++ b/admin/attachments.php @@ -36,10 +36,7 @@ if ($view_id != -1) $type = ($row['filetype']) ? $row['filetype'] : 'application/octet-stream'; header("Content-type: ".$type); header('Content-Length: '.$row['filesize']); - //if ($type == 'application/octet-stream') - // header('Content-Disposition: attachment; filename='.$row['filename']); - //else - header("Content-Disposition: inline"); + header("Content-Disposition: inline"); echo file_get_contents(company_path(). "/attachments/".$row['unique_name']); exit(); } @@ -69,7 +66,7 @@ if ($download_id != -1) } $js = ""; -if ($use_popup_windows) +if ($SysPrefs->use_popup_windows) $js .= get_js_open_window(800, 500); page(_($help_context = "Attach Documents"), false, false, "", $js); @@ -84,8 +81,14 @@ if ($Mode == 'ADD_ITEM' || $Mode == 'UPDATE_ITEM') { if (!transaction_exists($_POST['filterType'], $_POST['trans_no'])) display_error(_("Selected transaction does not exists.")); - elseif ($Mode == 'ADD_ITEM' && (!isset($_FILES['filename']) || $_FILES['filename']['size'] == 0)) + elseif ($Mode == 'ADD_ITEM' && !isset($_FILES['filename'])) display_error(_("Select attachment file.")); + elseif ($Mode == 'ADD_ITEM' && ($_FILES['filename']['error'] > 0)) { + if ($_FILES['filename']['error'] == UPLOAD_ERR_INI_SIZE) + display_error(_("The file size is over the maximum allowed.")); + else + display_error(_("Select attachment file.")); + } else { //$content = base64_encode(file_get_contents($_FILES['filename']['tmp_name'])); $tmpname = $_FILES['filename']['tmp_name']; @@ -94,7 +97,7 @@ if ($Mode == 'ADD_ITEM' || $Mode == 'UPDATE_ITEM') if (!file_exists($dir)) { mkdir ($dir,0777); - $index_file = ""; + $index_file = "