如何从krajee fileupload插件中删除上传的文件

时间:2017-03-23 10:35:09

标签: javascript c# jquery .net asp.net-mvc

上传正在运行,删除无效,网址正确无误。 点击删除按钮新上传的文件时,删除方法不会触发 我的js代码是:

$("#input-700").fileinput({
            uploadUrl: "/Account/UploadFiles", // server upload action
            uploadAsync: false,
            maxFileSize: 1000,
            maxFileCount: 5,
            uploadExtraData: function () {
                return {
                    company_mst_pk: '1',
                    user_mst_pk:'1'
                };
            },
            fileType: "any",
            overwriteInitial: false,
            initialPreviewAsData: true,
            initialPreview: [
            "http://localhost:49589/Uploads/_1ddChrysanthemum.jpg",
            "http://localhost:49589/Uploads/_1ddLighthouse.jpg",
            "http://localhost:49589/Uploads/1dd_Penguins.jpg",
            ],
            initialPreviewConfig: [
            { caption: "transport-1.jpg", size: 329892, width: "120px", url: "/Account/DeleteCV", key: 1 },
            { caption: "transport-2.jpg", size: 872378, width: "120px", url: "/Account/DeleteCV", key: 2 },
            { caption: "transport-3.jpg", size: 632762, width: "120px", url: "/Account/DeleteCV", key: 3 },
            ],
            deleteUrl: "/Account/DeleteCV",
            deleteExtraData: function () {
                return {
                    company_mst_pk: '1',
                    user_mst_pk: '1'
                };
            },
        });

enter image description here

1 个答案:

答案 0 :(得分:0)

当你上传文件时,你必须像json一样回答

{"initialPreview":["https://placeimg.com/800/460/animals/1"],"initialPreviewAsData":true,"initialPreviewConfig":[{"caption":"Animal-1.jpg","size":732762,"width":"120px","url":"/site/file-delete","key":1}]}

还有更多信息http://plugins.krajee.com/file-input-ajax-demo/6