为了在 sharepoint 中上传文件,我使用了 Web 部件和自动生成的表单。
上传文件的标签:
<input type="file" id="uploadfile" name="uploadfile" />
当我尝试在发布后拾取该文件时,无法使用 Request.Files 属性 (Request.Files["uploadfile"]) 访问该文件。 (Request.Files 在共享点上看起来像 null)
sharepoint 中有没有在输入标记上不使用“runat=server”的解决方案?
最佳答案
要将文件上传到共享点,您需要在表单标记上设置 enctype (enctype="multipart/form-data")。当您使用 时,Sharepoint 不会添加它。
使用非 ASP.NET 控件时,可以使用 'this.Page.Form.Enctype = "multipart/form-data";'在 Page_Load 上添加 enctype。
关于Sharepoint Web部件上传文件而不使用 "runat server",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1226612/