Failed to connect to ipfs.infura.io port 5001: Operation timed out

curl -X POST -F file=./test/sample-test.js -u “xxxx:xxxx” “https://ipfs.infura.io:5001/api/v0/add

curl: (28) Failed to connect to ipfs.infura.io port 5001: Operation timed out

Can anyone help me?

Hi,

The -F needs a @ - check the syntax described in “man curl” or other help.
Try removing the double-quotes - they are only needed to quote characters the shell thinks are special and there are none in the URL.

None of these changes should fix a time out though.
adding a -v can tell you what’s going wrong.

This worked for me:
curl -X POST -F file=@./test.txt https://ipfs.infura.io:5001/api/v0/add -v

Good luck!

Very glad to see your reply here, and I tried as below. It seems like it still didn’t work.

curl -X POST -F file=@./test/sample-test.js -u “xxxx:xxxx” https://xxxx:5001/api/v0/add -v

Note: Unnecessary use of -X or --request, POST is already inferred.

  • Trying 108.160.172.204:5001…
  • Connection failed
  • connect to 108.160.172.204 port 5001 failed: Operation timed out
  • Failed to connect to xxxx port 5001: Operation timed out
  • Closing connection 0

curl: (28) Failed to connect to xxxx port 5001: Operation timed out

@xuweimdm please try the following:

curl -X POST \
-F file=@"YOUR_FILE_HERE.jpeg" \
-U "PROJECT_ID:PROJECT_SECRET" "https://ipfs.infura.io:5001/api/v0/add"

Thanks. I tried your advice, but it didn’t work.