Xpages 文件上传控件和 mime 类型

发布于 2024-12-26 12:43:07 字数 825 浏览 1 评论 0原文

我在使用内置的 xpages fileuploader 控件将图像上传到表单字段时遇到问题。图像保存到的表单字段的配置如 Mats Knutsen 的这篇博客文章中所述:http://devxpages.blogspot.com/2011/03/display-picture-from-rich-text-field.html 。我还计划使用博客文章中描述的模板在 xpage 中显示图像,如下所示(http://server/MyDatabase.nsf/viewunid/docunid/imageField/M2?OpenElement)。

我知道我的文件上传器控件指向表单中的正确字段,因为在创建文档后我可以使用 Lotus Notes 客户端查看文档中的图像。然而;此时无法使用“http://server/MyDatabase.nsf/viewunid/docunid/imageField/M2?OpenElement”查看图片。

另一方面,如果我从客户端的文档字段中删除字段内容(图像),然后使用fileuploader控件返回xpage,并再次上传图像,则它可以正常工作,并且图像可以使用上面提到的 url 查看。

当我在第一次上传后访问字段属性时,字段的数据类型设置为富文本。

我第二次将相同的图像上传到同一文档中的同一字段时,字段属性数据类型设置为 MIME 部分,因为它可能也应该在第一次时获得。

有谁知道为什么我的文件上传器控件在第一次上传图像时不起作用,但是当我编辑文档并第二次上传图像时,一切似乎都正常?

I have a problem uploading an image to a form field using the built in xpages fileuploader control. The form field the image is saved to is configured like explained in this blog post by Mats Knutsen: http://devxpages.blogspot.com/2011/03/display-picture-from-rich-text-field.html . I Also plan to display the image in an xpage using the template described in the blog post, like this (http://server/MyDatabase.nsf/viewunid/docunid/imageField/M2?OpenElement).

I know my fileuploader control points to the correct field in the form, since i can see the image in the document using the Lotus Notes Client after the document is created. However; the picture can not be viewed using "http://server/MyDatabase.nsf/viewunid/docunid/imageField/M2?OpenElement" at this point.

On the other hand, if I delete the field contents (the image) from the document field in the client, go back to the xpage with the fileuploader control, and uploads the image a second time, it works perfectly, and the image can be viewed using the url mentioned above.

When I access field properties after the first upload, the Data Type of my field is set to Rich Text.

The second time I upload the same image to the same field in the same document, the field properties Data Type is set to MIME Part, as it probably should have gotten the first time around as well.

Does anyone know why my file uploader control does not work the first time i upload the image, but when I edit the docuement and upload the image a second time, everything seems to be ok?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

゛时过境迁 2025-01-02 12:43:07

我首先会尝试避免将图像上传到 RichText 中。如果您将图像作为常规附件上传,会破坏您的应用程序吗?然后,您可以使用 .../$File/imgfilename.jpg 引用它(使用上传期间使用的文件名 - 由 @AttachmentNames 检索)

I would try to avoid uploading images into the RichText in the first place. Would it break your application if you resort to uploading the image as a regular attachment? You then can reference it using .../$File/imgfilename.jpg (using the file name used during upload - retrieved by @AttachmentNames)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文