- Реализовал возможность загрузки файлов с клиента в директорию на сервере.
- Настроил доступ к статическим файлам, таким как картинки, стили, и т.д. https://www.youtube.com/watch?v=bmMWrTMB5uo&list=PLU2ftbIeotGpAYRP9Iv2KLIwK36-o_qYk&index=10
This commit is contained in:
@@ -5,3 +5,5 @@ spring.datasource.password=123456
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.freemarker.expose-request-attributes=true
|
||||
spring.freemarker.suffix=.ftl
|
||||
upload.path=/home/kashey/soft/sweater/uploads
|
||||
|
||||
|
||||
3
src/main/resources/static/style.css
Normal file
3
src/main/resources/static/style.css
Normal file
@@ -0,0 +1,3 @@
|
||||
body {
|
||||
color: #191970;
|
||||
}
|
||||
@@ -7,9 +7,10 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<form method="post">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="text" name="text" placeholder="Enter message" />
|
||||
<input type="text" name="tag" placeholder="tag">
|
||||
<input type="file" name="file">
|
||||
<input type="hidden" name="_csrf" value="${_csrf.token}" />
|
||||
<button type="submit">Add message</button>
|
||||
</form>
|
||||
@@ -30,6 +31,11 @@
|
||||
<span>${message.text}</span>
|
||||
<i>${message.tag}</i>
|
||||
<strong>${message.authorName}</strong>
|
||||
<div>
|
||||
<#if message.filename??>
|
||||
<img src="/img/${message.filename}">
|
||||
</#if>
|
||||
</div>
|
||||
</div>
|
||||
<#else>
|
||||
No messages found
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<head>
|
||||
<title>Sweater</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link href="/static/style.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user