Compare commits
No commits in common. "2e9d90a0ae7b3eab93b900e8a40525e39f2d8c4b" and "afaad60e509a37d8b44a798c53b64edb03756e84" have entirely different histories.
2e9d90a0ae
...
afaad60e50
3 changed files with 2 additions and 34 deletions
2
main.cpp
2
main.cpp
|
@ -5,7 +5,6 @@
|
||||||
#include <print>
|
#include <print>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <filesystem>
|
|
||||||
|
|
||||||
int atoi_newline(const char *data)
|
int atoi_newline(const char *data)
|
||||||
{
|
{
|
||||||
|
@ -338,7 +337,6 @@ int main()
|
||||||
char *end = search_substring(chunk, final_boundary.c_str(), file_size);
|
char *end = search_substring(chunk, final_boundary.c_str(), file_size);
|
||||||
write_file(filename, chunk, end);
|
write_file(filename, chunk, end);
|
||||||
free(chunk);
|
free(chunk);
|
||||||
netlib::send_packet(std::make_tuple(std::string("HTTP/1.1 200 OK\r\n")), user);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
2
netlib
2
netlib
|
@ -1 +1 @@
|
||||||
Subproject commit 344f771aa83755fa6acdcd74a621362adc1fd5b7
|
Subproject commit 5a4d644261435c9ea6ca40369f55ce849fbab3ae
|
32
test.html
32
test.html
|
@ -20,11 +20,6 @@
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
transition: background-color 0.3s, border-color 0.3s;
|
transition: background-color 0.3s, border-color 0.3s;
|
||||||
}
|
}
|
||||||
#drop_zone.dragover
|
|
||||||
{
|
|
||||||
border-color: green;
|
|
||||||
background-color: #e0ffe0;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -34,12 +29,9 @@
|
||||||
ondrop="dropHandler(event);"
|
ondrop="dropHandler(event);"
|
||||||
ondragover="dragOverHandler(event);"
|
ondragover="dragOverHandler(event);"
|
||||||
ondragenter="dragEnterHandler(event);"
|
ondragenter="dragEnterHandler(event);"
|
||||||
ondragleave="dragLeaveHandler(event);"
|
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="status"></div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const dropZone = document.getElementById('drop_zone');
|
const dropZone = document.getElementById('drop_zone');
|
||||||
|
|
||||||
|
@ -75,18 +67,9 @@
|
||||||
}
|
}
|
||||||
function dragEnterHandler(ev)
|
function dragEnterHandler(ev)
|
||||||
{
|
{
|
||||||
document.getElementById('drop_zone').classList.add('dragover');
|
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
function dragLeaveHandler(ev)
|
|
||||||
{
|
|
||||||
if (ev.target === document.getElementById('drop_zone'))
|
|
||||||
{
|
|
||||||
document.getElementById('drop_zone').classList.remove('dragover');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function uploadFile(file)
|
function uploadFile(file)
|
||||||
{
|
{
|
||||||
|
@ -96,25 +79,12 @@
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
|
||||||
formData.append('uploadedFile', file, file.name);
|
formData.append('uploadedFile', file, file.name);
|
||||||
document.getElementById('status').textContent = 'se esta subiendo el archivo';
|
|
||||||
fetch(url,
|
fetch(url,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData,
|
body: formData,
|
||||||
})
|
})
|
||||||
.then(
|
|
||||||
response =>
|
|
||||||
{
|
|
||||||
if (response.ok)
|
|
||||||
{
|
|
||||||
document.getElementById('status').textContent = 'se subio el archivo';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
document.getElementById('status').textContent = 'Hubo un error subiendo el archivo';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue