]> Softwares of Agnibho - simpleipd.git/commitdiff
Allow PDF as report
authorAgnibho Mondal <mondal@agnibho.com>
Mon, 17 May 2021 06:32:41 +0000 (12:02 +0530)
committerAgnibho Mondal <mondal@agnibho.com>
Mon, 17 May 2021 06:32:41 +0000 (12:02 +0530)
attachments.php
report.php

index b8ff3d5075743696ad67231b7c5c8cbe2a0d9d78..2007734f1b6048d5ccbefce478dea1979c733abe 100644 (file)
@@ -15,6 +15,9 @@ if(!empty($_GET["pid"])){
     if(in_array($_FILES["upload"]["type"], ["image/jpeg", "image/jpg", "image/png", "image/gif", "application/pdf"])){
       $fname=str_replace("/", "", $pid)."-".time()."-".rand(1000,9999).".".pathinfo($_FILES["upload"]["name"], PATHINFO_EXTENSION);
       move_uploaded_file($_FILES["upload"]["tmp_name"], "data/attachments/".$fname);
+      if(!empty($_GET["req"])){
+        $db->omitRequisition($_GET["req"]);
+      }
     }
     else{
       $error=$error."Only jpg, png, gif, pdf files are supported.";
@@ -44,6 +47,11 @@ $error=$error."</p>";
   <body>
     <div class="container">
       <?php echo getInfo($pid);?>
+      <form class="mt-3 mb-3" method="post" enctype="multipart/form-data">
+        <label for="upload">Select file to upload. JPG, PNG, GIF and PDF files are supported. Size limit: <span id="size-limit"><?php echo str_replace("M", "MB", ini_get("upload_max_filesize"));?></span><span id="upload-error"></span></label>
+        <input type="file" name="upload" id="upload" class="form-control">
+        <input type="submit" value="Upload" class="mt-2 btn btn-primary">
+      </form>
       <div id="attachments">
         <?php echo $pdfs;?>
           <div class="row">
@@ -51,11 +59,6 @@ $error=$error."</p>";
           </div>
       </div>
       <?php echo $error;?>
-      <form method="post" enctype="multipart/form-data">
-        <label for="upload">Select file to upload. JPG, PNG, GIF and PDF files are supported. Size limit: <span id="size-limit"><?php echo str_replace("M", "MB", ini_get("upload_max_filesize"));?></span><span id="upload-error"></span></label>
-        <input type="file" name="upload" id="upload" class="form-control">
-        <input type="submit" value="Upload" class="mt-2 btn btn-primary">
-      </form>
     </div>
     <?php include("lib/foot.php");?>
   </body>
index c79189205900d458f7dc4681745289fc139e7760..004019c9cb4f5e5a9406e2c526089a49f0592265 100644 (file)
@@ -41,6 +41,7 @@ if(!empty($_GET["pid"]) && !empty($_GET["form"])){
         <div class="card-body">
           <h4 class="card-title">Add New Report</h4>
           <?php echo $form;?>
+          <p class="text-right"><a href="attachments.php?pid=<?php echo $pid;?>&req=<?php echo $_GET["req"];?>">Upload PDF instead</p>
         </div>
       </div>
     </div>