Upload a file
EXM enables uploading files to Arweave with no tokens or wallets involved in the process. This is particularly helpful when wanting to leverage Arweave for storage without blockers.
For the moment, it is only possible to upload files to Arweave through EXM by using the REST Api.
CURL
JS
curl --location --request POST 'https://api.exm.dev/api/upload?token=YOUR_TOKEN' \
--form '[email protected]"/My/Documents/File.png"'
var formdata = new FormData();
formdata.append("file", fileInput.files[0], "picture.png");
var requestOptions = {
method: 'POST',
body: formdata,
redirect: 'follow'
};
fetch("https://api.exm.dev/api/upload?token=YOUR_TOKEN", requestOptions)
.then(response => response.json())
.then(result => console.log(result.id))
.catch(error => console.log('error', error));
Above we can see the different examples on how to upload files to Arweave through EXM by only using your API key.
In order to request the API, it is important to note the API is expecting form data as its payload with the following fields:
Field | Description |
---|---|
file | File to be uploaded |
When a file is uploaded successfully, a JSON response will be given containing the Arweave id of the file
Object {
id: string;
}
post
https://api.exm.dev/api
/upload
Upload any file to Arweave.
Last modified 18d ago