Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor A5hleyRich

    (@a5hleyrich)

    Yes, you can use the as3cf_object_meta filter.

    https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront-tweaks/blob/master/amazon-s3-and-cloudfront-tweaks.php#L30

    Returning something like this should work:

    $args['ContentDisposition'] = 'attachment';
    Thread Starter robphat

    (@robphat)

    Awesome. If I understand that correctly, Tweaks is a plugin, and I just create a file for it in /plugins and paste the content of that file on github into it, right? And then I uncomment out line 30 and edit it to this:

    add_filter( ‘as3cf_object_meta’, array( $this, ‘object_meta’ ), 10, 2 );
    $args[‘ContentDisposition’] = ‘attachment’;

    Is that correct?

    Thread Starter robphat

    (@robphat)

    Well that’s not correct. I just tried it and it did nothing. Sorry, but I don’t php very well. How exactly do I tweak that link the tweak plugin to include the code you gave me:

    $args[‘ContentDisposition’] = ‘attachment’;

    Plugin Contributor A5hleyRich

    (@a5hleyrich)

    Correct. Uncomment line 30 and change 141-143 too:

    function object_meta( $args, $post_id ) {
    	$args['ContentDisposition'] = 'attachment';
    
    	return $args;
    }

    This will only work for new uploads.

    Thread Starter robphat

    (@robphat)

    Awesome. Thanks so much. I had actually entered some code in functions.php to only remove mp3’s after offloading, but to keep all other files. But I didn’t see the filter for that in tweaks. Is there one there?

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Setting Content Disposition onupload’ is closed to new replies.