ASP.NET:FileUpload控件使用长文件名失败 [英] ASP.NET: FileUpload control failing with long filenames

查看:198
本文介绍了ASP.NET:FileUpload控件使用长文件名失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的一位客户更是打破了软件在各方面都可以想象,他只是发现了这一点。

One of our clients is breaking the software in every way imaginable, and he's just discovered this one.

如果用户试图上传文件具有非常长的文件名(我认为用户试图用180字符的文件名),FileUpload控件拒绝承认它在IE7。

If the user tries to upload a file with a very long filename (I think the user is trying with a 180 character filename), the FileUpload control refuses to recognise it on IE7.

点击浏览按钮,浏览到该文件,点击它,点击上传按钮,文本框应该显示文件名是空白。任何人都知道这事,修复等?

Click on the Browse button, browse to the file, click on it, click the Upload button, and the text box that should show the filename is blank. Anyone know anything about this, fixes, etc?

我设法找到它的这个asp.net论坛讨论,但它没有在这个问题上洒下的光线。

I managed to find this asp.net forums discussion on it, but it didn't shed much light on the issue.

应用程序是用Visual Studio 2008中,这发生在IE7,但不是FF3或Chrome。如果我使用其他两种浏览器,它正确填写FileUpload控件,但休息当你真正尝试做上传,因为生成的文件名/路径太长。

The app is written in Visual Studio 2008, and this occurs in IE7, but not FF3 or Chrome. If I use either of the other two browsers, it fills the FileUpload control correctly, but breaks when you actually try to do the upload because the resulting filename/path is too long.

享受
随机

推荐答案

这可能不是特别的ASP.NET甚至是IE7的问题。

This might not be specifically an ASP.NET or even an IE7 problem.

Windows已经对完整路径(*)260个字符的限制,这可以用长文件名的几个嵌套的文件夹即可轻松抵达,特别是如果你的用户文件夹中,已经有相当长的路径开始(如:C:\\ Documents和Settings \\布赖恩Popalopadopaslopalos \\我的文档'。或'桌面')

Windows has a limit of 260 characters on full pathnames(*) and this can be easily reached with a few nested folders with long filenames, especially if you're starting in a user folder, which already has quite a long pathname (eg. 'C:\Documents and Settings\Brian Popalopadopaslopalos\My Documents' or 'Desktop').

当你点击该限制,事情开始去扭曲。重命名文件,移动文件夹,搜索​​等等都开始出问题好奇的方式。这将是不足为奇的浏览器也失败了,有可能是没有太多可以做的。

When you hit that limit, things start to go screwy. Renaming files, moving folders, searching and so on all start to go wrong in curious ways. It would be no surprise if browsers also failed and there is probably not much you can do about it.

(* - 事情实际上比这更复杂一些,但仍...)

(* - things are actually a bit more complicated than that, but still...)

这篇关于ASP.NET:FileUpload控件使用长文件名失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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