2

我在我的 Asp.Net Core2 应用程序中使用 Dropzone.js 进行文件上传和存储例程。这很好用,除非我想使用配置选项。无论我在做什么,浏览器都无法识别代码。这似乎很愚蠢,但我仍然敢向您提出问题。我已将代码放在底部的 Head 部分,Form 中,但没有任何效果。有任何想法吗?这是我的代码AddFile.cshtml。为了防止编程错误,我从开发人员的 github 页面复制了配置选项的代码。

<!-- Link to stylesheet for Dropzone  -->
<link rel="stylesheet" href="~/css/dropzone.css" />

@model MyApp.Models.FilePath


@{
    ViewData["Title"] = "Add a document";
}

<div class="row">
<section class="col-md-12">
    <div>
        <form id="doc-dropper" name="doc-dropper" class="dropzone" action="/AddFile" method="post" enctype="multipart/form-data">
            <div class="fallback">
                <input name="file" type="file" multiple />
            </div>
            <div class="form-group">
                <label asp-for="CaseID" class="control-label">(Pas aan indien nodig)</label>
                <select asp-for="CaseID" class="form-control" asp-items="ViewBag.CaseID"><option selected="selected" value="">---</option></select>
            </div>
         </form>
        <script>
            Dropzone.options.docDropper = { // The camelized version of the ID of the form element

                // The configuration we've talked about above
                autoProcessQueue: false,
                uploadMultiple: true,
                parallelUploads: 100,
                maxFiles: 100,
                dictDefaultMessage = 'standaard boodschap',
                acceptedFiles = 'images/*'                    

            };
        </script>
    </div>
 </section>
</div>
<div><a href='javascript:history.go(-1)'>Go Back to Previous Page</a></div>

<script src="~/lib/dropzone/dropzone.js"></script>

下面我添加了由 Google Chrome 编译的源代码:

<div>
        <form id="doc-dropper" name="doc-dropper" class="dropzone dz-clickable" action="/AddFile" method="post" enctype="multipart/form-data">

            <div class="form-group bmd-form-group is-filled">
                <label class="control-label bmd-label-static" for="CaseID">(Pas aan indien nodig)</label>
                <select class="form-control" id="CaseID"   name="CaseID"><option selected="selected" value="">---</option>
                  <option value="1"></option>
                  <option value="2"></option>
                  <option value="3"></option>
                  <option selected="selected" value="4">MySelectedAnswer</option>
                  <option value="5"></option>
                </select>
            </div>

        <div class="dz-default dz-message"><span>Drop files here to upload</span></div></form>
        <script>
            Dropzone.options.docDropper = { // The camelized version of the ID of the form element

                // The configuration we've talked about above
                autoProcessQueue: false,
                uploadMultiple: true,
                parallelUploads: 100,
                maxFiles: 100,
                dictDefaultMessage = 'standaard boodschap',
                acceptedFiles = 'images/*'                    

            };
        </script>
    </div>
4

0 回答 0