Hello, I'm having a problem sending a file to Storage. What am I doing wrong?
I tried to do it through the documentation, but without success. Could anyone help? Thanks.
const filePath = Application.tmpPath('uploads', fileName);
await storage.createFile(Env.get('APPWRITE_BUCKET'), ID.unique(), filePath)
What SDK are you using?
nodejs
You can't pass a path. You need to use InputPath
I've already tried using the inputFile
However, the error below occurs.
[01:27:49.539] FATAL (intranet/16908): "uncaughtException" detected Error: EISDIR: illegal operation on a directory, read [01:27:49.539] WARN (intranet/16908): pino.final with prettyPrint does not support flushing Error: EISDIR: illegal operation on a directory, read [ warn ] Underlying HTTP server died with "1 code"
What's your code with input file?
And based on this error, it sounds like your code is trying to upload a folder rather than a file
Is it because I'm using it on Windows?
if (file) {
// Gera um nome aleatório para o arquivo
let fileName = ${randomUUID()}.${file.extname};
await file.move(Application.tmpPath('uploads'), {
name: fileName
});
if (file.state === 'moved') {
await storage.createFile(Env.get('APPWRITE_BUCKET'), ID.unique(), InputFile.fromPath(Application.tmpPath('uploads'),fileName))
}
return fileName;
}
Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting
Indeed, he was carrying a briefcase. Now it worked perfectly.
Thanks again @Steven
[SOLVED] Cannot read properties of undefined (reading 'pipe')
Recommended threads
- Github App "Failed to retrieve access to...
When trying to connect the Github App on 1.8.1 I recieve this error: ```[Error] Method: GET [Error] URL: /v1/vcs/github/callback [Error] Type: Exception [Error]...
- Endless certificate generation cycle
Hello, when I try to add the subdomain stats.hedgehog-rp.ru, I get an infinite loop while the certificate is being generated. There are no problems with adding ...
- Update from 1.8 to 1.8.1 failing
I have spent the past 2 hours trying to figure this out but I really dont know what to do. 1.8. was a fresh install because the upgrade from 1.7.4 was a total m...