Corda uploading a file attach and download

0 votes

I have tried to upload and send a file with the help of following linkhttps://github.com/corda/corda/tree/release-M14

When I tried to used it in Cordaapp example it is showing many error. Is there any simple example to upload the file and attach? Please suggest. Thanks

Sep 19, 2018 in Blockchain by slayer
• 29,370 points

retagged Nov 22, 2018 by Priyaj 1,371 views

1 answer to this question.

0 votes

Hey, i found an example that i think would be helpful for you: 

 https://github.com/corda/blacklist.

You can upload an attachment to a node via HTTP:

<form action="/upload/attachment" method="post" enctype="multipart/form-data">
    <div class="form-group">
        <input type="file" name="jar" class="form-control">
    </div>
    <br>
    <button type="submit" class="btn btn-default">Upload JAR</button>
</form>

Or you can upload an attachment using an RPC client:

val nodeAddress = parse(arg)
val rpcConnection = CordaRPCClient(nodeAddress).start("user1", "test")
val proxy = rpcConnection.proxy

val attachmentHash = uploadAttachment(proxy, JAR_PATH)

Then you add the attachment to a TransactionBuilder as follows:

val txBuilder = TransactionBuilder(notary)
    .addAttachment(attachmentHash)

It is up to you where you get the attachment hash. You may pass it as an argument to the flow, for example.

answered Sep 19, 2018 by digger
• 26,740 points

Related Questions In Blockchain

0 votes
0 answers

Network Parameter and additional node info file in R3 corda?

Is that network parameter and additional node ...READ MORE

Jun 21, 2019 in Blockchain by anonymous
722 views
+1 vote
2 answers

What is a blockchain and ethereum?

Some of the use-cases are: Healthcare Medical records are ...READ MORE

answered Aug 9, 2018 in Blockchain by Omkar
• 69,220 points
880 views
+1 vote
1 answer
+1 vote
1 answer

How do i generate corda nodes keystores in dev mode?

In Corda, the node will look into ...READ MORE

answered Apr 11, 2018 in Blockchain by Perry
• 17,100 points
1,699 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP