![](https://cdn.discordapp.com/avatars/735393303071031307/eccc824e427573f740ea589b279d7e0e.webp)
I'm sorry if I did something wrong when I try to upload a file with InputFile.fromPath, but I can't figure what.
I'm on node v.18 and node-appwrite v.13
TypeScript
var sdk = require('node-appwrite');
var fs = require('fs');
const client = new sdk.Client()
.setEndpoint('https://cloud.appwrite.io/v1')
.setProject('<projectID>')
.setSession('');
const storage = new sdk.Storage(client);
storage.createFile(
'<bucketID>',
'unique()',
sdk.InputFile.fromPath('out.png', 'out.png'),
["read('any')"]
);
```
My image is on the same level than my index.js.
... sdk.InputFile.fromPath('out.png', 'out.png'), ^ TypeError: Cannot read properties of undefined (reading 'fromPath')
TypeScript
Many thanks for your help.
TL;DR
Issue: Developers encountering a TypeError when trying to use 'sdk.InputFile.fromPath' to upload a file in a Node.js environment.
Solution: The 'fromPath' method belongs to the 'sdk.File' class, not 'sdk.InputFile'. Change the code to use 'sdk.File.fromPath' instead:
```javascript
sdk.File.fromPath('out.png', 'out.png')
``` Recommended threads
- File size error in appwrite self host ve...
I cannot specify file size in appwrite self host.
- can't able to transcode audio from appwr...
Im using ffmpeg to transcode the audio into dash format which can be use play into to my project, the problem is when want to transcode the audio.mp3 from appwr...
- Unlimited buckets?
Hello Appwrite. I'm contemplating giving each user I have 1 or 2 buckets. Is there any problem with this that I may find out about later? Can I do a billion b...
![](/images/bgs/pre-footer.png)