| 86 | } |
| 87 | |
| 88 | const uploadToServer = async (file, path, filename) => { |
| 89 | const formData = new FormData(); |
| 90 | formData.append('file', file); |
| 91 | formData.append('filename', filename); |
| 92 | const uri = `${config.baseURLApi}/file/upload/${path}`; |
| 93 | await Axios.post(uri, formData, |
| 94 | { |
| 95 | headers: { |
| 96 | 'Content-Type': 'multipart/form-data' |
| 97 | } |
| 98 | } |
| 99 | ); |
| 100 | |
| 101 | const privateUrl = `${path}/${filename}`; |
| 102 | |
| 103 | return `${config.baseURLApi}/file/download?privateUrl=${privateUrl}`; |
| 104 | }; |
| 105 | |
| 106 | const handleFile = async (event) => { |
| 107 | const file = event.target.files[0]; |