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"])
|
||||
def upload_file():
|
||||
|
||||
#### TODO вынести в обычный метод отправки
|
||||
if request.method == "POST":
|
||||
uploaded_file = request.files["file"]
|
||||
|
||||
minioClient = Minio(
|
||||
"static.guaranteedstruggle.host",
|
||||
)
|
||||
if uploaded_file:
|
||||
minioClient = Minio( "static.guaranteedstruggle.host" )
|
||||
bucket_name = "thread-pics"
|
||||
size = os.fstat(uploaded_file.fileno()).st_size
|
||||
|
||||
|
@ -3,10 +3,17 @@
|
||||
<div class="row">
|
||||
<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>
|
||||
<div class="input-field col s6">
|
||||
<input id="send_this_text" name="send_this_text" type="text" >
|
||||
<label for="send_this_text">Печатать сюда</label>
|
||||
</div>
|
||||
<form hx-encoding='multipart/form-data' _='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'>
|
||||
<div class="input-field col s6">
|
||||
<input id="send_this_text" name="send_this_text" type="text" >
|
||||
<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 class="card-action">
|
||||
@ -15,14 +22,14 @@
|
||||
type="submit" name="action"
|
||||
hx-post="/post_to_another_post/{{ target_post_id }}"
|
||||
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>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- <div class="row">
|
||||
<form hx-encoding='multipart/form-data' hx-post='/send_dudes'
|
||||
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'>
|
||||
<input type='file' name='file'>
|
||||
@ -31,7 +38,7 @@
|
||||
</button>
|
||||
<progress id='progress' value='0' max='100'></progress>
|
||||
</form>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- <h1>Загрузить картинку:</h1>
|
||||
<input type="file" #file placeholder="Загрузить картинку" (change)="sendPic($event)" style="display:none;">
|
||||
<button type="button" class="btn btn-success" (click)="file.click()">Загрузить картинку</button>
|
||||
|
Loading…
Reference in New Issue
Block a user