Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.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
如何使用extjsrest(AJAX)调用形成上传下载的文件_Extjs_File Upload_Extjs5 - Fatal编程技术网

如何使用extjsrest(AJAX)调用形成上传下载的文件

如何使用extjsrest(AJAX)调用形成上传下载的文件,extjs,file-upload,extjs5,Extjs,File Upload,Extjs5,我需要上传一个使用Extjs Ajax调用下载的文件 下面是我如何努力做到这一点 Ext.Ajax.request({ url: '/someRemoteCloudRepository', // url of remote cloud repository from which i download file. method: 'GET', headers: { 'Content-Type': 'application/octet-stream'

我需要上传一个使用Extjs Ajax调用下载的文件

下面是我如何努力做到这一点

Ext.Ajax.request({
    url: '/someRemoteCloudRepository',    // url of remote cloud repository from which i download file.
    method: 'GET',
    headers: {
        'Content-Type': 'application/octet-stream'
    },
    success: function(response) {   // upon success, i need to upload this file into my server application
       var form = Ext.create('Ext.form.Panel', {
            items: [{
                xtype: 'filefield',
                name: 'file_path',
            }]
        });
        form.down('filefield').setValue(response.responseText); // Is this the right way to set the downloaded file content ?

        var url = 'uploadFile?id=' + '123'; 
        var params = "size=" + getFileSize(); // how can I get the response data size ?

        if (form.isValid()) {
            form.submit({
                url: url,
                params: params,
                timeout: 60,
                waitMsg: 'Uploading file...',
                success: function(formBasic, action) {
                    Ext.Msg.alert('', 'Upload Failed. Please try again');
                },
                failure: function(response, opts) {
                    Ext.Msg.alert('', 'Upload Failed. Please try again');
                }
            });
        }
    },

    failure: function(response) {
        Ext.Msg.alert('Status', 'Failed to download file from remote cloud repo.');
    }
});
我可以从远程云服务器下载文件,并在
response.responseText
success:function(response)
中看到数据

然后,我用
filefield
创建一个简单表单,并用responseText设置其值,然后执行表单提交。在inspector工具中,我看到正在发送多部分请求,但状态仍处于“挂起”状态或请求超时

从远程源下载后,如何上载文件

我尝试的方法正确吗?如果没有,我怎么做