asp.net forums开源论坛中发帖上传文件时总是提示find不了文件,急用,在线等

pledsant 2009-12-30 04:23:59
问题:

1. 使用的是opensoft.web这个开源库,在发帖上传文件时候总是find不了文件,即路径不对,很奇怪的是我上传的路径和这个控件的有个路径总是不一样,他有一个文件大小的判断,而且路径总是什么c:windows/temp/adfafdaf(一个好像密匙一样的数字)/abc.rar(我上传的那个文件名)

2. 总是在上面那个报错,我手工建立这个路径并且将文件手工拷贝其中,运行的时候就可以上传,不过这个文件路径又消失了,可能是临时文件的原因

问:我没有设置那个什么鬼路径呀,这是怎么回事呀,急用,谢谢
...全文
54 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lijianyang2010 2009-12-31
  • 打赏
  • 举报
回复
有人用过吗 版主帮个忙呀
lijianyang2010 2009-12-30
  • 打赏
  • 举报
回复
public static void AddPostAttachment(Post p, HttpPostedFileCollection postedFileCollection, string attachmentDescription)
{
if (p != null)
{
foreach (HttpPostedLocalFile postedfile in postedFileCollection)
{
// 附件上传格式说明 by venjiang 20040925
// 基于安全因素,不支持filename.ext.ext这种格式,若采用可使用
// string Extension=Attachment.Substring(Attachment.LastIndexOf("."));
string[] Extensions = postedfile.FileName.Split('.');
string FileExtension;

try
{
// little error capturing if the file does not have an extension
//
FileExtension = Extensions[Extensions.Length - 1].ToString();
}
catch
{
throw new ForumException(ForumExceptionType.PostInvalidAttachmentType);
}

// now some site settings checks
//
if (!Globals.GetSiteSettings().EnableAttachments)
throw new ForumException(ForumExceptionType.PostAttachmentsNotAllowed);

else if ((postedfile.ContentLength > (Globals.GetSiteSettings().MaxAttachmentSize * 1024)) && Globals.GetSiteSettings().MaxAttachmentSize > 0)
//throw new ForumException(ForumExceptionType.PostAttachmentTooLarge, Globals.GetSiteSettings().MaxAttachmentSize.ToString());
return;
else if (!ValidateAttachmentType(FileExtension))
//throw new ForumException(ForumExceptionType.PostInvalidAttachmentType, FileExtension);
return;
else
{
PostAttachments.AddPostAttachment(p, new Components.PostAttachment(postedfile, attachmentDescription));
}
}
}
}
vip__888 2009-12-30
  • 打赏
  • 举报
回复
代码呢?
pledsant 2009-12-30
  • 打赏
  • 举报
回复
怎么没有人回应呀
BaoShiqiang 2009-12-30
  • 打赏
  • 举报
回复
帮顶

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧