Reputation: 8608
I'm using the following PHP code to get images uploaded from mobile devices:
<?php
$base=$_REQUEST['image'];
$binary=base64_decode($base);
header('Content-Type: bitmap; charset=utf-8');
$file = fopen('uploaded_image.jpg', 'wb');
fwrite($file, $binary);
fclose($file);?>
I want to send these images directly to Amazon's S3 service. Do I have to write the JPEG on disk each time? Can't I just send the binary to Amazon S3 and let it generate the JPEG? I'm worried the local write will hammer my server.
Upvotes: 0
Views: 328
Reputation: 71384
You might want to consider using s3fs to mount your S3 bucket as a local drive on your server. You could then write files directly to that mount location. You can also specify a local directory to be used as a cache for the s3fs mount to speed things up if you want your application to be able to read these files.
Here is the link to s3fs Google Code page: http://code.google.com/p/s3fs/
Upvotes: 1