| 204 | const fileNamePrefix = `${Date.now()}_${slug}`; | 204 | const fileNamePrefix = `${Date.now()}_${slug}`; |
| 205 | const fileBase64 = await getBase64Async(file); | 205 | const fileBase64 = await getBase64Async(file); |
| 206 | let base64Data = fileBase64.split(',')[1]; | 206 | let base64Data = fileBase64.split(',')[1]; |
| 207 | const fileNameParts = file.name.split('.'); | 207 | const extension = file.name.substring((file.name.lastIndexOf('.') + file.name.length) % file.name.length + 1); |
| 208 | const extension = fileNameParts.length > 1 ? fileNameParts.at(-1) : ''; | | |
| 209 | | 208 | |
| 210 | // If file is image | 209 | // If file is image |
| 211 | if (file.type.startsWith('image/')) { | 210 | if (file.type.startsWith('image/')) { |