-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8240672
commit f06ebf5
Showing
4 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use Cro::HTTP::Router; | ||
use Cro::WebApp::Template; | ||
|
||
sub preserving_file_inputs-routes() is export { | ||
|
||
my $upload-dir = "$*HOME/Downloads/uploads/"; | ||
|
||
unless $upload-dir.IO.e { | ||
$upload-dir.IO.mkdir or die "Failed to create upload directory: $!"; | ||
} | ||
|
||
route { | ||
template-location 'templates/preserving_file_inputs'; | ||
|
||
get -> { | ||
template 'index.crotmp'; | ||
} | ||
|
||
post -> 'upload' { | ||
content 'text/html', "Uploaded!"; | ||
} | ||
} | ||
} | ||
|
||
#@bp.route("/") | ||
#def index(): | ||
# return render_template("preserving_file_inputs/index.html.j2") | ||
# | ||
#@bp.route("/upload", methods=("POST",)) | ||
#def upload_hyperscript(): | ||
# return "Uploaded!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<h3>Before</h3> | ||
<form id="binaryFormBefore" enctype="multipart/form-data" hx-post='/preserving_file_inputs/upload' hx-swap="outerHTML" | ||
hx-target="#binaryFormBefore"> | ||
<input type="file" name="binaryFile"><br> | ||
<button type="submit">Submit</button> | ||
</form> | ||
|
||
<h3>After</h3> | ||
<input form="binaryFormAfter" type="file" name="binaryFile"> | ||
<form id="binaryFormAfter" enctype="multipart/form-data" hx-post='/preserving_file_inputs/upload' hx-swap="outerHTML" | ||
hx-target="this"> | ||
<button type="submit">Submit</button> | ||
</form> |