added ttl to post req

added ttl to post req
This commit is contained in:
Benjamin Loh 2023-10-23 15:38:51 +08:00
parent a6144cb4e9
commit 94623b7c4b
2 changed files with 4 additions and 2 deletions

View File

@ -24,7 +24,7 @@ function DownloadFile() {
// Create a temporary anchor element for downloading the file // Create a temporary anchor element for downloading the file
const a = document.createElement('a'); const a = document.createElement('a');
a.href = url; a.href = url;
a.download = 'downloaded-file.txt'; // Specify the filename a.download = response.data.filename;
a.click(); a.click();
// Revoke the URL to release resources // Revoke the URL to release resources

View File

@ -9,10 +9,12 @@ function ShareFile() {
const handleFileUpload = (file) => { const handleFileUpload = (file) => {
setFile(file); setFile(file);
setPasscode('1234'); //setPasscode('1234');
console.log(file);
if (file) { if (file) {
const formData = new FormData(); const formData = new FormData();
formData.append('files', file); formData.append('files', file);
formData.append('ttl', "2");
// Send POST request to the backend API using Axios // Send POST request to the backend API using Axios
axios.post('http://127.0.0.1:8000/api/files/', formData) axios.post('http://127.0.0.1:8000/api/files/', formData)