However this method need to expose IPFS API (port 5001) to the network. Exposing IPFS API to outside network is not secure in the real world. My questions is beside uploading file(s) through IPFS API (port 5001), Is there any more secure way to upload file or directory into IPFS (for example through IPFS Gateway, port 8080)? If there is better way to do it, would you please give me some details about how to implement it? Thank you for your comments.
I’m currently working on a project called Temporal which exposes an easy to use API for interacting with IPFS nodes and more without exposing access to the underlying IPFS API that runs on port 5001. https://github.com/RTradeLtd/Temporal
You either have to expose direct access to port 5001 and lock it down, or create some sort of API to intercept requests and forward them to the IPFS node.
@postables: My concerns is if we allow people to upload files through API port 5001, the uploaded files will remain in the IPFS blocks system forever and we can’t control these files since we don’t know the files’ hash id. Is there any way we can upload files into IPFS and just allowing them staying in the IPFS temporarily and after certain period of time, these files will be deleted through garbage collect process? Any comments will be highly appreciated. Thanks.
That’s not quite how IPFS works I would recommend reading in more detail about how the system works. You can add files through the API and still have them get GCd.
You can use Infura servers and use ipfs-http-client to connect and upload data to the infura ipfs servers.
Note: The Infura IPFS servers don’t allow to upload big files. I am not sure about the upper limit of the file size, but I have tried it, and it throws error above a certain limit.