拖放文件并上传提交按钮在PHP中单击

时间:2017-03-04 12:49:35

标签: javascript php jquery html html5

我想在dropzone中删除文件后将文件拖到放置区域,然后必须附加HTML文件上传控件。并在点击提交按钮上传文件。

<form name="form1" method="post" enctype="multipart/form-data" action="index.php">
    <div id="dropContainer" style="border:1px solid black;height:100px;width:100px;">
        Drop Here
    </div>
    Should update here: <input type="file" name="fileInput" id="fileInput" />
    <input type="submit" name="submit" value="submit"/>
</form>

2 个答案:

答案 0 :(得分:1)

http://www.codexworld.com/drag-and-drop-file-upload-using-dropzone-php/ 在这里找到它的完整演示和代码解释

答案 1 :(得分:1)

我想将附件说明字段验证为必填字段,不要上传文件。单击提交按钮后,仅上载文件并验证所需字段。

&#13;
&#13;
<form name="form1" method="post" enctype="multipart/form-data" action="index.php">
    <div id="dropContainer" style="border:1px solid black;height:100px;width:100px;">
        Drop Here
    </div>
    <div>
      Attachment Description : <input type="text" name="description" id="description" required>
    </div>
    <div>
      Should update here: <input type="file" name="fileInput" id="fileInput" />
    </div>
    <input type="submit" name="submit" value="submit"/>
</form>
&#13;
&#13;
&#13;