# Nexus REST API Upload to Raw repository upload empty files

**URL:** https://community.sonatype.com/t/nexus-rest-api-upload-to-raw-repository-upload-empty-files/5403
**Category:** Sonatype Nexus Repository
**Created:** [November 19, 2020, 1:21pm UTC](https://community.sonatype.com/t/nexus-rest-api-upload-to-raw-repository-upload-empty-files/5403 "2020-11-19T13:21:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sverre.moe](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@sverre.moe](https://community.sonatype.com/u/sverre.moe)
#### Post date: [November 19, 2020, 1:21pm UTC](https://community.sonatype.com/t/nexus-rest-api-upload-to-raw-repository-upload-empty-files/5403/1 "2020-11-19T13:21:42Z")

</div>

Trying to upload files to a Raw repository in Nexus using the REST API.

[https://help.sonatype.com/repomanager3/rest-and-integration-api/components-api](https://help.sonatype.com/repomanager3/rest-and-integration-api/components-api)

Taken from the Maven Examples, but changed to use Raw fields.

`curl -v -u 'deployment:password' -X POST -F 'raw.directory=/config/test' -F 'raw.asset1=fileArchive.tar.gz' -F 'raw.asset1.filename=fileArchive.tar.gz' 'https://nexus.company.com:8443/service/rest/v1/components?repository=reponame'`

Not sure what is wrong. The files are uploaded, but they are empty in Nexus.  
Running Nexus OSS 3.21.1

While writing this I took a look at suggested existing topics.  
There I found another way to upload to RAW.

This works.  
`curl -v -u 'deployment:password' --upload-file fileArchive.tar.gz 'https://nexus.company.com:8443/repository/reponame/config/test/fileArchive.tar.gz'`

Perhaps this could have been told in the documentation for the REST API, with RAW Examples.
