Reply To: S3Sync with Ajax File upload control
Hi Simon,
Looking at that plugin, it appears that it registers completely separate fields in Gravity Forms. It’s also performing its own custom upload functionality, given the AJAX nature of the upload. It should be possible to integrate it with SyncS3, but you’d need some custom code to bridge the gap.
Although custom code is beyond the scope of support, here are a few pointers that should help you get started:
1. Look at the itsg_gf_ajaxupload_post_upload
action. This is contained in the AJAX file upload plugin. It looks like the hook you’ll want to use to fire the offloading to S3.
2. Use the syncs3_s3_client()
function to create an S3 client, and pass it your configuration details. Something like this:
$client_config = array( 'version' => 'latest', 'region' => 'us-west-2', 'credentials' => array( 'key' => 'access-key', 'secret' => 'secret-key', ), ); $s3 = syncs3_s3_client( $client_config );
3. The $s3
client object you created in the last step provides access to S3 methods for uploading files. Therefore, you can use whatever method you need to upload your files to S3. You can use the putObject()
method, or the MultipartUploader()
if you’re using chunked uploads.
Hopefully that will help you get started. If you’re not comfortable with coding yourself, we’d recommend getting in touch with a developer from Codeable who can help you out.