FileUpload控件不会接受0KB文件? [英] FileUpload control won't accept 0kb file?
问题描述
我是用空白的文本文件,运行一些测试,快要疯了,因为FileUpload1.HasFile总是回来假的,即使它显然有一个文件。然后我切换测试文件到上面的东西0 KB(即TXT在他们的文本文件),然后它的工作。
I was using blank text files to run some tests, and was going crazy because FileUpload1.HasFile was always coming back false, even though it clearly had a file. I then switched test files to something above 0 kb (i.e. txt files with text in them), and then it worked.
据我所知,你不能上传的0 KB的东西。这是真的吗我读到MSDN上的文件上传类,但没有注意到有什么,上面写着0 KB的文件将被忽略/作为不是一个文件处理。
As far as I can tell, you can't upload something of 0 kb. Is this true? I read about the FileUpload class on MSDN, but didn't notice anything that says files of 0 kb would be ignored/treated as not a file.
现实和实践,我不认为这是一个问题的多少(为什么你想上传一个空白文件?),但我能想象某种罕见的情况下,我可能要保留一个空间一些不具备的内容还没有,像一个用户一个空白的文本文件,填写时,他/她有时间。
Realistically and practically, I don't see this as being much of a problem (why would you want to upload a blank file?), but I can imagine some kind of rare situation where I might want to reserve a space for something that doesn't have content yet, like a blank text file for a user to fill in when he/she has time.
推荐答案
您可以使用的 FileUpload.PostedFile地产
,这将使你对文件的访问,即使含量 0
字节
这篇关于FileUpload控件不会接受0KB文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!