不使用文件上传时找不到路径的一部分 [英] Could not find a part of the path when not using file upload
本文介绍了不使用文件上传时找不到路径的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
我在一个页面上有两个文件上传控件,当我不使用第二个文件上传控件时,我点击提交按钮,我看到这样的消息:
无法找到路径'path ...'的一部分。
第19行:FileUpload2.SaveAs(+ Server.MapPath(..//)+ \\my images path / \\+ FileUpload2.FileName);
i当我不使用第二个文件上传时控制,任何没有添加到我的数据库中的东西,并没有显示任何错误!
请帮助我... TNX
hi
I have two file upload control in one page, when i dont use second fileupload control and i click submit button,i see this message:
Could not find a part of the path 'path...'.
Line 19: FileUpload2.SaveAs("" + Server.MapPath("..//") + "\\my images path/\\" + FileUpload2.FileName);
i want when i don't use second file upload control,any thing not add in my database,and not show any error!
please help me...TNX
推荐答案
这是一个简单检查FileName属性:
That's a simple check on the FileName property:
if (!string.IsNullOrEmpty(FileUpload2.FileName))
{
//your code for saving the image on the server etc.
}
这篇关于不使用文件上传时找不到路径的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文