英文:
Error in storing HTML content with image in a file in spring boot
问题
你好,我想将带有图像的电子邮件模板的HTML代码存储在文件中,但出现了“实体过大”的错误。但是,当我想存储大图像时,它会显示“实体过大错误”。
为了将图像存储到文件中,我使用了Spring Boot的API,其中我以字符串格式获得HTML代码的内容以存储到文件中。
以下是一些接收到的HTML内容示例:
这是一个正常工作的JSON请求:
"templateContent": "<h1><span style=\"color: #800080;\">Hello</span></h1>..."
这是另一个不正常工作的JSON内容,由于长度较大,我无法在此粘贴,我将在这里上传图像:
请帮我解决将带有图像的HTML内容存储到文件中的问题。
注意:我从前端团队接收到了
templateContent
的值。
英文:
Hello I want to store email templates HTML Coded with images in a file and I got an error that entity is too large, However, it works fine with tiny images but whenever I want to store big images it shows me Entity too large error
For storing the image to file I use spring boot APIs where I get HTML coded content in string format to store into a file
here is some sample of HTML content receiving in request parameter
Here is my json Request that works fine
"templateContent": "<h1><span style=\"color: #800080;\">Hello</span></h1>\n<h3>&nbsp;</h3>\n<p>&nbsp;</p>\n<p><span style=\"color: #000080;\">This Is <strong>Kuldeep Vaishnav</strong> working as a Software Engineer<img src=\"https://html-online.com/editor/tinymce4_6_5/plugins/emoticons/img/smiley-cool.gif\" alt=\"cool\" /></span></p>\n<p><span style=\"color: #000080;\">-:Template Properties:-</span></p>\n<table style=\"width: 318.583px;\" border=\"solid\">\n<tbody>\n<tr>\n<td style=\"width: 21px;\">id</td>\n<td style=\"width: 65px;\">Detail</td>\n<td style=\"width: 238.583px;\">Properties</td>\n</tr>\n<tr>\n<td style=\"width: 21px;\">1</td>\n<td style=\"width: 65px;\">Name</td>\n<td style=\"width: 238.583px;\">REG_WELCOME_MESSAGE_English.html</td>\n</tr>\n<tr>\n<td style=\"width: 21px;\">2</td>\n<td style=\"width: 65px;\">Language</td>\n<td style=\"width: 238.583px;\">Engliash</td>\n</tr>\n<tr>\n<td style=\"width: 21px;\">4</td>\n<td style=\"width: 65px;\">Alias</td>\n<td style=\"width: 238.583px;\">Default</td>\n</tr>\n<tr>\n<td style=\"width: 21px;\">3</td>\n<td style=\"width: 65px;\">Domain</td>\n<td style=\"width: 238.583px;\">Default</td>\n</tr>\n</tbody>\n</table>\n<h3><span style=\"color: #ff0000;\">&nbsp;Thanks</span></h3>\n",
here is my another json content that not works fine i can't even paste here so i will upload Image here
Please help me out to store HTML content with an image in a file
> Note:- I am receiving that templateContent value from frontend team
答案1
得分: 3
这是前端团队的一个问题。
他们通过在Node上添加以下内容来解决:
app.use(bodyParser.json({ limit: '2000mb' }))
将JSON大小设置为最大200MB。
英文:
This is an issue with the frontend team.
They fixed it by adding
app.use(bodyParser.json({ limit: '2000mb' }))
on the Node to set the json size to be up to 200mb.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论