I got error when upload file(contact form 7)

I use contact form 7 and it is not usable on product page but if I go to function.php file on my site-theme and write this code over there;

add_action( 'woocommerce_before_add_to_cart_button' , 'my_upload_file_thing' );    function my_upload_file_thing(){       echo do_shortcode('[contact-form-7 id="545" title="file-upload"]');      } 

when I write this code, it seems on product page but when i go upload something as a client, i get error. but when I normally use this plugin, I do not get error.