pdf 文件上传并存储在 javascript 中的文件夹中

pdf file upload and stored in a folder in javascript

我是 java 脚本的初学者。我想上传 java 脚本中的文件 (pdf) 并存储在特定文件夹中。我做不到。请帮助.. 我在 php 中做。但我也在 java 脚本中做。

这是我的 php 代码...

<form action="<?php print $PHP_SELF?>" enctype="multipart/form-data" method="post">
   Last Name:<br /> <input type="text" name="name" value="" /><br />
   Homework:<br /> <input type="file" name="homework" value="" /><br />
   <p><input type="submit" name="submit" value="Submit Notes" /></p>
</form>

<?php
   define ("FILEREPOSITORY","./");

   if (isset($_FILES['homework'])) {

      if (is_uploaded_file($_FILES['homework']['tmp_name'])) {

         if ($_FILES['homework']['type'] != "application/pdf") {
            echo "<p>Homework must be uploaded in PDF format.</p>";
         } else {
            $today = date("m-d-Y");
            if (! is_dir(FILEREPOSITORY.$today)) {
               mkdir(FILEREPOSITORY.$today);
            }
            $name = $_POST['name'];
            $result = move_uploaded_file($_FILES['homework']['tmp_name'], FILEREPOSITORY.$today."/"."$name.pdf");

            if ($result == 1) 
               echo "<p>File successfully uploaded.</p>";
            else 
               echo "<p>There was a problem uploading the homework.</p>";
         }
      }
   }
?>

我也想在phpapi.

上传pdf文件

您可以使用Jquery文件上传功能。这里有一个link,学习代码并实现。 https://blueimp.github.io/jQuery-File-Upload/