implemented file upload
This commit is contained in:
17
src/functions/uploadFile.ts
Normal file
17
src/functions/uploadFile.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
async function uploadFile(file:File,id: string): Promise<boolean> {
|
||||
|
||||
console.debug(file)
|
||||
|
||||
|
||||
const res = await fetch(`/api/file?${new URLSearchParams({id:id}).toString()}`,{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": file.type
|
||||
},
|
||||
body: file
|
||||
})
|
||||
|
||||
return res.status == 200
|
||||
}
|
||||
|
||||
export default uploadFile
|
||||
Reference in New Issue
Block a user