This commit is contained in:
parent
5790ea301c
commit
8415845488
6
app.py
6
app.py
@ -180,13 +180,13 @@ def post_to_post(post_key):
|
|||||||
|
|
||||||
@app.route("/send_dudes", methods=["POST"])
|
@app.route("/send_dudes", methods=["POST"])
|
||||||
def upload_file():
|
def upload_file():
|
||||||
|
|
||||||
|
#### TODO вынести в обычный метод отправки
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
uploaded_file = request.files["file"]
|
uploaded_file = request.files["file"]
|
||||||
|
|
||||||
minioClient = Minio(
|
|
||||||
"static.guaranteedstruggle.host",
|
|
||||||
)
|
|
||||||
if uploaded_file:
|
if uploaded_file:
|
||||||
|
minioClient = Minio( "static.guaranteedstruggle.host" )
|
||||||
bucket_name = "thread-pics"
|
bucket_name = "thread-pics"
|
||||||
size = os.fstat(uploaded_file.fileno()).st_size
|
size = os.fstat(uploaded_file.fileno()).st_size
|
||||||
|
|
||||||
|
@ -3,10 +3,17 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<span class="card-title">Создай то, о чем будут говорить многие. Ты отвечаешь: <a href="#post-{{ target_post_id }}">>>{{ target_post_id }}</a></span>
|
<span class="card-title">Создай то, о чем будут говорить многие. Ты отвечаешь: <a href="#post-{{ target_post_id }}">>>{{ target_post_id }}</a></span>
|
||||||
<a class="btn-floating halfway-fab waves-effect waves-light red" href="#post-{{ target_post_id }}"><i class="material-icons">>></i></a>
|
<a class="btn-floating halfway-fab waves-effect waves-light red" href="#post-{{ target_post_id }}"><i class="material-icons">>></i></a>
|
||||||
<div class="input-field col s6">
|
<form hx-encoding='multipart/form-data' _='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'>
|
||||||
<input id="send_this_text" name="send_this_text" type="text" >
|
<div class="input-field col s6">
|
||||||
<label for="send_this_text">Печатать сюда</label>
|
<input id="send_this_text" name="send_this_text" type="text" >
|
||||||
</div>
|
<label for="send_this_text">Печатать сюда</label>
|
||||||
|
</div>
|
||||||
|
<div class="input-field col s6">
|
||||||
|
<input id="file" name="file" type="file" >
|
||||||
|
<label for="file">Upload</label>
|
||||||
|
<progress id='progress' value='0' max='100'></progress>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
@ -15,14 +22,14 @@
|
|||||||
type="submit" name="action"
|
type="submit" name="action"
|
||||||
hx-post="/post_to_another_post/{{ target_post_id }}"
|
hx-post="/post_to_another_post/{{ target_post_id }}"
|
||||||
hx-target="#neu-posts"
|
hx-target="#neu-posts"
|
||||||
hx-include="[name='send_this_text']"
|
hx-include="[name='send_this_text'], [name='file']"
|
||||||
>
|
>
|
||||||
Отправить!!
|
Отправить!!
|
||||||
<i class="material-icons right">send</i>
|
<i class="material-icons right">send</i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<!-- <div class="row">
|
||||||
<form hx-encoding='multipart/form-data' hx-post='/send_dudes'
|
<form hx-encoding='multipart/form-data' hx-post='/send_dudes'
|
||||||
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'>
|
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'>
|
||||||
<input type='file' name='file'>
|
<input type='file' name='file'>
|
||||||
@ -31,7 +38,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<progress id='progress' value='0' max='100'></progress>
|
<progress id='progress' value='0' max='100'></progress>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div> -->
|
||||||
<!-- <h1>Загрузить картинку:</h1>
|
<!-- <h1>Загрузить картинку:</h1>
|
||||||
<input type="file" #file placeholder="Загрузить картинку" (change)="sendPic($event)" style="display:none;">
|
<input type="file" #file placeholder="Загрузить картинку" (change)="sendPic($event)" style="display:none;">
|
||||||
<button type="button" class="btn btn-success" (click)="file.click()">Загрузить картинку</button>
|
<button type="button" class="btn btn-success" (click)="file.click()">Загрузить картинку</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user