curl: (26) Failed to open/read local data from file/application
Asked Answered
T

10

26

I'm trying to upload a ipa file to saucelabs storage but getting the error as mentioned above.

The command that I'm using -

$ curl -F 'payload=@/Users/<user-name>/Downloads/<file_name>.ipa' -F name=<file_name>.apk -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY"  'https://api.us-west-1.saucelabs.com/v1/storage/upload'

I'm on mac. I've seen the questions on stackoverflow but none of them answers.

Theatrical answered 8/1, 2021 at 11:15 Comment(0)
S
14

I was able to resolve this by not using single or double quotes around the file name.

curl -u "<userName>:<accessKey>" \
-X POST "https://api-cloud.browserstack.com/app-automate/xcuitest/v2/test-suite" \
-F file=@/path/to/app/file/Application-debug-test.zip
Stanstance answered 14/6, 2022 at 20:45 Comment(1)
this worked for me. though a colleague of mine was able to run our command (which was very similar to the example here) with quotes, so I wonder if the coniguration of each individual machine matters here?Kalmar
T
7

There might be a problem escaping your path. For me your command works, if the file is correct (I get an unauthorized of course). (curl 7.64.1)

Try your command from the Downloads folder:

cd /Users/<user-name>/Downloads
curl -F @<file_name>.ipa -F name=<file_name>.apk -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY"  'https://api.us-west-1.saucelabs.com/v1/storage/upload'

You may have to escape characters in your filename. Tip: You can also try drag and drop the file form finder to Terminal while the cursor is at the point where the filename is. Terminal will escape those automatically.

Tajo answered 3/5, 2021 at 19:0 Comment(0)
W
4

In addition to making sure the quotes were in the correct place, I had to remove the tilde that I first included in my file path.

Bad:

curl -F dsym=@"~/Users/<user-name>/Downloads/<file_name>.dSYM.zip" -H "X-APP-LICENSE-KEY: theKey" https://theplaceto.upload

Good:

curl -F dsym=@"/Users/<user-name>/Downloads/<file_name>.dSYM.zip" -H "X-APP-LICENSE-KEY: theKey" https://theplaceto.upload```**
Willing answered 2/12, 2022 at 20:17 Comment(0)
M
2

I resolved this problem by replacing single quotes with double quotes instead.

I changed this:

curl -F '[email protected]' https://location-bq-datasets.cloudfunctions.net/sample-endpoint

curl: (26) Failed to open/read local data from file/application

To this:

curl -F "[email protected]" https://location-bq-datasets.cloudfunctions.net/sample-endpoint

You also don't need to place your endpoint https://api.us-west-1.saucelabs.com/v1/storage/upload in quotes.

Martymartyn answered 13/11, 2022 at 11:19 Comment(0)
M
2

Or maybe you're not in the right folder that contains the file.

Mosemoseley answered 11/2 at 16:25 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Tonsorial
Z
1

For me I was using iTerm on MacOS and noticed this issue. I found out it was because iTerm did not have access to my Downloads folder and even though I was trying to access that folder there was no prompt. After I went into settings and enabled access to the Downloads folder this issue was fixed for me.

Mac settings windows showing file options

Ziguard answered 8/11, 2023 at 12:26 Comment(0)
P
1

I had to add a content type for it to work: -H 'Content-Type: "application/zip"'

Parcae answered 12/2 at 14:29 Comment(0)
P
0

Use below command for me it resolved

curl -F "file=@C:/Users/LENOVO/Desktop/git/ppt/8.apk" http://localhost:8000/api/v1/upload -H "Authorization:f06ecb3505899296f03b0c21d7dc5baf83fb999e3d0b4c1243874c82c0184874"
Phippen answered 28/10, 2022 at 9:59 Comment(0)
F
0

For me there is a real permission problem. Trivial error at previous stage does not set proper permissions and flow get stuck.

Check the permissions, like: head you_file

Free answered 17/4 at 8:23 Comment(0)
T
0

If you have a comma in <file_name>.apk, it needs to be quoted or escaped. See https://superuser.com/a/590213

For example, if <file_name>.apk is app,v1.apk, then the command should look like this if we escape the comma:

$ curl -F 'payload=@/Users/<user-name>/Downloads/<file_name>.ipa' -F "name=@app\,v1.apk" -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY"  'https://api.us-west-1.saucelabs.com/v1/storage/upload'

...or this if we quote the filename:

$ curl -F 'payload=@/Users/<user-name>/Downloads/<file_name>.ipa' -F "name=@\"app,v1.apk\"" -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY"  'https://api.us-west-1.saucelabs.com/v1/storage/upload'

You could also just rename the file so the filename doesn't contain the comma.

Tillich answered 13/6 at 14:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.