Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# jQuery文件上载以前上载的文件删除_C#_Asp.net_Jquery File Upload - Fatal编程技术网

C# jQuery文件上载以前上载的文件删除

C# jQuery文件上载以前上载的文件删除,c#,asp.net,jquery-file-upload,C#,Asp.net,Jquery File Upload,环境:.NET 4.51 WebForms 当包含jQueryFileUpload的页面加载时,我想为用户列出服务器上的文件,并允许他们删除它们。我曾跟随其他职位: 并产生了以下代码,将结果中的开始和取消按钮替换为删除按钮: <script> jQuery(document).ready(function () { //Initialise plugins FormFileUpload

环境:.NET 4.51 WebForms

当包含jQueryFileUpload的页面加载时,我想为用户列出服务器上的文件,并允许他们删除它们。我曾跟随其他职位:

并产生了以下代码,将结果中的开始和取消按钮替换为删除按钮:

 <script>             
        jQuery(document).ready(function () {
            //Initialise plugins
            FormFileUpload.init();

            //Get the images previously uploaded by the user
            $.ajax({
                dataType: 'json',
                type: "GET",
                url: "http://localhost:4837/Handlers/JQueryFileUploadHandler.ashx",
            }).done(function (data) {
                console.log(data.files);
                $('#fileupload').fileupload('add', { files: data.files });

                //Remove the Start & Cancel replacing with delete
                $("button").remove(".btn.red.cancel");

                $("table .btn.blue.start").prop('value', 'Delete');
                $("table .btn.blue.start > span").html("Delete");
                $("table .btn.blue.start > i").removeClass("icon-upload");
                $("table .btn.blue.start > i").addClass("icon-trash");
                $("table .btn.blue.start").addClass("red");
                $("table .btn.blue.start.red").removeClass("blue");

                console.log('======');
                $("table .btn.red.start").each(function (index) {
                    var imgFileName = $(this).closest('tr').find('td:nth-child(2)').text();
                    imgFileName = imgFileName.trim();

                    $(this).attr("data-type", "POST");
                    $(this).attr("data-url", "http://localhost:4837/handlers/JQueryFileUploadHandler.ashx?file=" + imgFileName + "&_method=DELETE");
                    console.log(imgFileName);
                });
                console.log('======');
            });

        });


        //<button data-url="http://localhost:4837/handlers//JQueryFileUploadHandler.ashx?file=V3.png&amp;_method=DELETE" data-type="POST" class="btn red delete">
        //                          <i class="icon-trash"></i>
        //                          <span>Delete</span>
        //                      </button>                                               
        //<input type="checkbox" class="toggle" value="1" name="delete">

    </script>
我缺少文件\u方法请求参数。因此,我的问题是:

a) 我需要做什么来修复我的解决方案,以便获得完整的URL --或--
b) 是否有人有一个完全有效的解决方案,从服务器上获取文件列表,其中每个文件都显示一个删除按钮,以便用户可以管理以前上载的文件?

为什么要用c#标记此文件?因为我使用c#webforms来执行此操作,所以.NET可能会做一些事情来让我发疯。我的后端处理程序是一个ASHX,因此.NET在这种情况下也是相关的。
<button class="btn start red" value="Delete" data-type="POST" data-url="http://localhost:4837/handlers/JQueryFileUploadHandler.ashx?file=V3.png&amp;_method=DELETE">
                          <i class="icon-trash"></i>
                          <span>Delete</span>
                      </button>
http://localhost:4837/handlers/JQueryFileUploadHandler.ashx