proxy image upload through my server to transloadit

Archived from the Transloadit support forum. Originally posted on January 8, 2012; details may be outdated, see our docs for current behavior. Original thread

I am trying to figure out a way to handle a file upload from a client to my server and then pass that file to transloadit. This way my server will handle putting the right template together (or referencing a template I already have on transloadit). I am using nodejs and I am currently using node-transloadit. What I cannot figure out is if there is a way to stream the file from my client through my server to transloadit. I was thinking there was some way to do this maybe with the node-transloadit module and the addStream(…) call. I am using node-express so I am sitting in the route handler and I have the req,res parameters but I am not having any luck figuring out how to get things working with node-transloadit.

In the mean time for testing I am simply using the /http/import robot to pull a image file from S3 while I try to find a way to stream a file from a client through my server to transloadit without storing the file on my server first.

What I cannot figure out is if there is a way to stream the file from my client through my server to transloadit.

Why do you need to do this? The point of our service is that you don’t need to do that, so maybe we can solve this another way?

My issue is I have clients that need to push images and video up to my server. Really I need to get these images and videos into storage (like S3) and then store the relative information I need in a database on my server. I like Transloadit since I can process the images and videos. What I can’t do though is put the Transloadit keys down at the client for signing the Transloadit requests. My clients are mobile devices not browsers if that makes a difference to this topic. Things I was considering:

  • Proxy the image/video through my server to Transloadit (not ideal since I need to deal with the bandwidth)
  • Upload with my server to S3 then use the http/import to have Transload it process the image in the background to and from S3 (This is what I do now since I was already uploading images but again I still need to handing the upload)
  • Have the client call my server and pass parameters that I use to build a Transloadit request. I give this signed request back to the client and the client calls Trnasloadit with the signed request I created?

Perhaps there are other ideas I am not considering?

Perhaps there are other ideas I am not considering?

Well, I’m not sure why you are ruling out embedding the Transloadit key into your client apps for signing the requests? Are you worried about users extracting this information from your binaries?

--fg

Yes. This would be a problem for sure. For this same reason we would not put our twitter or Facebook keys in our apps either.

Well I think in that case passing the parameters for the request from your client to your server for signing is the way to go. It shouldn’t be that difficult compared to your other options.

--fg

I do agree this would be best. I also thank you for discussing this somewhat general non technical topic.

Greg

I do agree this would be best. I also thank you for discussing this somewhat general non technical topic.

Sure, let me know if there is anything else we can help with.

I mean I would also help you with a few node.js hints, but I really believe that it wouldn’t be as good of a solution as sending the data from your clients to use directly.

--fg

Very true. We ultimately want to have the clients send data directly to Transloadit. You have a much better focus on solving data bandwidth issue and we don’t want to attempt to replicate this. We would rather focus on our product and service.

Greg

Sounds good!