如何在 WooCommerce 支付网关管理选项中使用文件上传选项?

How to use file upload option in WooCommerce payment gateway admin options?

我正在开发一个插件以在 WooCommerce 中集成支付网关。我以前做过一个。

但是在这个中,我需要在网关设置中上传一个密钥文件,用于在向相关门户网站发出付款请求之前对数据进行哈希处理。

我有以下允许选择文件的代码,但我怀疑这在后端是否有效。

    'sandbox_pvt_key' => array(
        'title'       => __( 'Test Private Key', 'woocommerce-custom-gateway' ),
        'type'        => 'file',
        'desc_tip'    => true,
        'description' => __( 'Please upload the test private key file; this is needed in order to test payment.', 'woocommerce-custom-gateway' ),
        'default'     => '',
    ),

输出如下所示:

任何人都可以知道网关设置中是否支持此选项吗?如果没有,谁能指导我如何通过 hook/filters 或任何其他方式对其进行自定义。

这可以在process_admin_options()

中实现
public function process_admin_options() {
   $this->upload_key_files();

   $saved = parent::process_admin_options();

   return $saved;
}

private function upload_key_files() {
    //handle uploads here
}