上传文件时在某些IE中出现错误 [英] Error coming out in some IE while uploading file

查看:94
本文介绍了上传文件时在某些IE中出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

面对这里的奇怪情况。以下代码甚至在IE中工作正常,但在某些IE中它产生以下错误,只是不知道它为什么会来,以及如何解决这个问题。请帮帮我。

这里的文件正在上传,这意味着当我们收到字符串的响应时出现错误,只有在那时错误即将来临。

关注是我的代码。



Facing a strange situation here. following code is working fine everywhere even in IE but in some IE it is producing following error, just dont know why it is coming and how to resolve this. please help me out.
here file is getting uploaded which means error is coming while we are getting the response which is string, only at that time error is coming.
following is my code.

/ controller side code
@RequestMapping(value = "upload", method=RequestMethod.POST)
public @ResponseBody String upload(HttpServletRequest request, HttpServletResponse response,
@RequestPart("dataFile") MultipartFile file
){ if(file!=null){
//code to upload file and will return 1
        return "1";
    }
    return "0";//otherwise it will return 0
}










<html>

<script language="Javascript">
function fileUpload(form, action_url, div_id) {
    // Create the iframe...
    var iframe = document.createElement("iframe");
    iframe.setAttribute("id", "upload_iframe");
    iframe.setAttribute("name", "upload_iframe");
    iframe.setAttribute("width", "0");
    iframe.setAttribute("height", "0");
    iframe.setAttribute("border", "0");
    iframe.setAttribute("style", "width: 0; height: 0; border: none;");

    // Add to document...
    form.parentNode.appendChild(iframe);
    window.frames['upload_iframe'].name = "upload_iframe";

    iframeId = document.getElementById("upload_iframe");

    // Add event...
    var eventHandler = function () {

            if (iframeId.detachEvent) iframeId.detachEvent("onload", eventHandler);
            else iframeId.removeEventListener("load", eventHandler, false);

            // Message from server...
            if (iframeId.contentDocument) {
                content = iframeId.contentDocument.body.innerHTML;
            } else if (iframeId.contentWindow) {
                content = iframeId.contentWindow.document.body.innerHTML;
            } else if (iframeId.document) {
                content = iframeId.document.body.innerHTML;
            }

            document.getElementById(div_id).innerHTML = content;

            // Del the iframe...
            setTimeout('iframeId.parentNode.removeChild(iframeId)', 250);
        }

    if (iframeId.addEventListener) iframeId.addEventListener("load", eventHandler, true);
    if (iframeId.attachEvent) iframeId.attachEvent("onload", eventHandler);

    // Set properties of form...
    form.setAttribute("target", "upload_iframe");
    form.setAttribute("action", action_url);
    form.setAttribute("method", "post");
    form.setAttribute("enctype", "multipart/form-data");
    form.setAttribute("encoding", "multipart/form-data");

    // Submit the form...
    form.submit();

    document.getElementById(div_id).innerHTML = "Uploading...";
}
</script>

//html code 
<!-- index.php could be any script server-side for receive uploads. -->
<form>
<input type="file" name="dataFile" id="dataFile" /></br>
<input type="button" value="upload"

         önClick="fileUpload(this.form,'upload','uploadShow'); return false;" >
<div id="uploadShow"></div>
</form>

</html>







错误:



平台版本信息

Windows:6.1.7601.65536(Win32NT)

普通L anguage运行时间:4.0.30319.1022

System.Deployment.dll:4.0.30319.1(RTMRel.030319-0100)

clr.dll:4.0.30319.1022(RTMGDR.030319- 1000)

dfdll.dll:4.0.30319.1(RTMRel.030319-0100)

dfshim.dll:4.0.31106.0(Main.031106-0000)



来源

部署网址:http:// URL(无法显示)



错误摘要

以下是错误摘要,这些错误的详细信息将在后面的日志中列出。

*激活http:// URL(无法显示)导致例外。检测到以下失败消息:

+正在下载http:// URL(无法显示)未成功。

+远程服务器返回错误:(401)未经授权。



组件商店交易失败摘要

未检测到交易错误。



警告

此操作期间没有任何警告。



操作进度状态

* [30/04 / 2014 09:32:49]:http:// URL(cant show)的激活已经开始。



错误详情

关注在此操作期间检测到错误。

* [30/04/2014 09:32:50] System.Deployment.Application.DeploymentDownloadException(未知子类型)

- 正在下载http :// URL(无法显示)没有成功。

- 来源:System.Deployment

- 堆栈跟踪:

在System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)

at System .Deployment.Application.SystemNetDownloader.DownloadAllFiles()

在System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)

在System.Deployment.Application.DownloadManager.DownloadManifestAsRawFile (URI&安培; sourceUri,String targetPath,IDownloadNotification notification,DownloadOptions options,ServerInformation& serverInformation)

在System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore子商店,Uri& sourceUri,TempFile& tempFile,SubscriptionState& subState,IDownloadNotification通知,DownloadOptions选项,ServerInformation& serverInformation)

在System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore子存储,Uri& sourceUri,TempFile& tempFile,SubscriptionState& subState,IDownloadNotification通知,DownloadOptions选项)

在System.Deployment.Application .ApplicationActivator.PerformDeploymentActivation(Uri activationUri,Boolean isShortcut,String textualSubId,String deploymentProviderUrlFromExtension,BrowserSettings browserSettings,String& errorPageUrl)

在System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(对象状态)

---内部异常---

System.Net.WebException

- 远程服务器返回错误:(401)未经授权。

- 来源:系统

- 堆栈跟踪:

在System.Net .HttpWebRequest.GetResponse()

在System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(下载下一个问题)



组件商店交易细节

没有可用的交易信息。

推荐答案

我看到的只有:

All I see is:
The remote server returned an error: (401) Unauthorized.





因此远程系统不了解你。



So the remote system doesn't know you.


这篇关于上传文件时在某些IE中出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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