douyi7055 2018-05-08 02:20
浏览 31

重力表单获取上传的文件路径

I have a gravity form that uploads a file into entries. i need to get the uploaded path after submission. Here is my existing code:

add_action( 'gform_pre_submission_13', 'pre_submission_handler' );
function pre_submission_handler( $form ) {
         //get uploaded file url path ( http:// )
}

Some documentation would be helpful

  • 写回答

1条回答 默认 最新

  • dpa31905 2018-05-09 06:17
    关注

    I have found solution to get file upload path after submission.

    Here you are using wromg action "gform_pre_submission". Enstead of "gform_pre_submission_13" action use "gform_after_submission_13". in this action, number 13 is your form id.
    Refer this link for more info : https://docs.gravityforms.com/gform_after_submission/

    Try Below code you will get the uploaded path after submission. Here is my code:

    function md_gform_after_submission_1( $entry, $form ) {
    
      $upload_path = GFFormsModel::get_upload_path( $entry[ 'form_id' ] );
      $upload_url = GFFormsModel::get_upload_url( $entry[ 'form_id' ] );
    
      $filename = str_replace( $upload_url, $upload_path, $entry[ '1' ] );
      echo "<div style='color:#446084;'><p><b>Your File has been stored here : </b><br/>$filename</p><div>";
    
    }
    add_action( 'gform_after_submission_1', 'md_gform_after_submission_1', 10, 2 );   
    
    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测