无法上传MSword文件 [英] Unable to Upload MSword File
本文介绍了无法上传MSword文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
if (FileUpload1.HasFile)
{
byte[] img = new byte[FileUpload1.PostedFile.ContentLength];
FileUpload1.PostedFile.InputStream.Read(img, 0, FileUpload1.PostedFile.ContentLength);
string file_ext = FileUpload1.PostedFile.FileName;
string ext = Path.GetExtension(file_ext);
Response.Write(FileUpload1.PostedFile.ContentLength);
if ((ext.ToLower() == ".doc") || (ext.ToLower() == ".docx"))
{
File.WriteAllBytes(Server.MapPath("~/hello" + ext), img);
}
}
上传图片时工作正常
When Uploading Image its working fine
推荐答案
我认为文件upload.save方法或其他东西需要用来代替file.writeallbytes
I think file upload.save method or something needs to be used instead of file.writeallbytes
我要上传的文件就是空的那就是为什么无法加载
File that i want to upload its Empty thats why unable to load
这篇关于无法上传MSword文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文