如何在blueimp jquery文件上传中加载文件数据以下载页面刷新模板 [英] How to load the file data to download template on page refresh in blueimp jquery file upload

查看:56
本文介绍了如何在blueimp jquery文件上传中加载文件数据以下载页面刷新模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似于此问题: https://github.com/blueimp/jQuery-File-Upload/issues/1466

每次页面加载时,默认情况下如何加载文件数据下载模板?似乎在谷歌没有答案.

everytime on page load, how do i load download template with file data by default? seem to be no answer in google.

谢谢.

推荐答案

使用此代码并检查您的显示图像的url.就我而言,我使用的是"/Upload/UploadHandler.ashx".

Use this code and check you url for display images. In my case I am using "/Upload/UploadHandler.ashx".

您在main.js中放入的代码.

This code you put in main.js.

$(function () {
        'use strict';

        // Initialize the jQuery File Upload widget:
        $('#fileupload').fileupload();

        $('#fileupload').fileupload('option', {
            maxFileSize: 500000000,
            resizeMaxWidth: 1920,
            resizeMaxHeight: 1200
        });

        // Enable iframe cross-domain access via redirect option:
        $('#fileupload').fileupload(
            'option',
            'redirect',
            window.location.href.replace(
                /\/[^\/]*$/,
                '/cors/result.html?%s'
            )
        );

        // Load existing files:
        $('#fileupload').addClass('fileupload-processing');
        $.ajax({
            // Uncomment the following to send cross-domain cookies:
            //xhrFields: {withCredentials: true},
            url: "/Upload/UploadHandler.ashx",
            dataType: 'json',
            context: $('#fileupload')[0]
        }).always(function () {
            $(this).removeClass('fileupload-processing');
        }).done(function (result) {
            $(this).fileupload('option', 'done')
                .call(this, $.Event('done'), { result: result });
        });
    });

这篇关于如何在blueimp jquery文件上传中加载文件数据以下载页面刷新模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆