How to add file to IPFS with filename?

Hi,

Im trying to add file to IPFS. Im using:
curl -X POST -F file=@myfile
-u “PROJECT_ID:PROJECT_SECRET”
https://ipfs.infura.io:5001/api/v0/add

but the result field “name” is equal with the hash of the file. What should i do to have to file name in the name field instead of the hash?

thanks
Macracanta

Meanwhile I found the problem: using - is in filenames is not a good idea…

1 Like

Hi @macracanta12, and welcome to the Infura community! Thanks for posting your solution so others in the community can reference it :slight_smile:

Hi @macracanta12 The name field for the result is typed to be a string.
This is the hash of the public key that can direct to users to the file.
It cannot be changed.
You can read more about it here https://docs.ipfs.io/concepts/ipns/#example-ipns-setup-with-cli

Hi, thanks yor the reply

1 Like