Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Unable to upload zip file from Azure pipeline VM to Confluence page

I'm trying to upload a zip file present in the Azure pipeline VM to Confluence page

retrieving the file name

out="$(basename $(Build.ArtifactStagingDirectory)/*.zip)"

echo $out

Upload command

curl -D- -u 'userid:token'
-H 'X-Atlassian-Token: nocheck'
-F 'file=@$(out)'

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

If I add the file name it's working fine.

3 answers

1 accepted

0 votes
Answer accepted

Hi @Saket Singh

Looking at the error output

./ line 2: Build.ArtifactStagingDirectory: command not found
./ line 4: Build.ArtifactStagingDirectory: command not found
./ line 7: Output: command not found
./ line 8: /home/vsts/work/1/s: No such file or directory
./ line 9: total: command not found
./ line 10: -rw-r--r--: command not found
./ line 11: command not found
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
./ line 16: -X: command not found
./ line 17: -H: command not found
./ line 18: -F: command not found
./ line 21: Output-: command not found
./ line 22: syntax error near unexpected token `26'
./ line 22: `curl: (26) Failed to open/read local data from file/application'

There are errors from line 2 onwards. The issue isn't that the upload isn't working, but pretty much everything isn't working. You have output mixed in with shell commands.

Lines 7~11 and 21~23 are causing issues. Also, confluence_url isn't working, as that's not a valid URL.

I suggest cleaning up first and then trying again.


0 votes

Hi @Saket Singh


I'm looking at this again and I realise now the error you're using $() instead of ${} in the shell commands.

It should be something like this

And replace

  • userid
  • token
  • confluence_url
  • page_id

with the correct values.

  1. cd ${Build.ArtifactStagingDirectory}
  2. temp="$(basename ${Build.ArtifactStagingDirectory}/*.zip)"
  4. curl -D- -u 'userid:token' \
  5. -X POST \
  6. -H 'X-Atlassian-Token: nocheck' \
  7. -F 'file=@"${Build.ArtifactStagingDirectory}/$temp"' \
  8. '${confluence_url}/rest/api/content/${page_id}/child/attachment'


It's working now. Thanks James!

0 votes
Pramodh M Community Leader Mar 03, 2022

Hi @Saket Singh 

Make sure the file which is generated has only one zip file content.

Also when the file is referenced in API, can you make sure the file path which is given has an absolute path

Please try the above and let me know


Hi @Pramodh M ,

only 1 zip file is getting generated in the directory.

I've provided the absolute path still getting the same error. Please refer to the below link for the updated command.


Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events