views:

621

answers:

1

I've seen ways to upload files directly to S3 and I've seen ways to upload a file already on the server. I need to modify the file's name before sending it on to S3, but I don't want to store it locally and then upload it, if I can help it. Is there a way to put it in a buffer or something? Thx.

+2  A: 

The file will always end up in the temporary directory first while the upload completes, even before you're able to work with the uploaded file. You get all the file's chunks before, and then it get rebuilt in the /tmp directory by default. So no, there's no "pass-through". But I guess you could re-upload directly from the temporary directory afterwards instead of moving it to another working directory.

lpfavreau
Thx. Didn't think about the fact that it writes to a temp folder first and that there's no way to intercept it.
Corey Maass
Well, there's always a way. You could probably rewrite part of PHP to have it all in memory but I guess it won't be worth the trouble. And having it on disk can mean you can put in place mechanisms for when it's down and maybe process files in bulk to S3, depending on what you're doing. :)
lpfavreau
Ha, rewriting PHP is def not for me. I'm just letting the file upload locally and then firing a script that will upload it to Amazon in the background. Good enough. Thanks for yr help.
Corey Maass