doumin1897 2015-09-27 03:11
浏览 8
已采纳

如何在服务器目录联系表单上保留上传的文件或附件7

I am working on a blog where I am using contact form 7. But I need these info to save into db and want to show in user profile with attachment also. As cf7 upload images or attachment temporary in wpcf_upload folders. I can save all data in custom table by this:

add_action( 'wpcf7_before_send_mail', 'save_application_form');

So first i have to keep images or attachment of cf7 permanently on server.

So please tell me how to do it?

Thanks

  • 写回答

3条回答 默认 最新

  • dozc1071 2015-09-27 03:33
    关注

    I would suggest you to create your own custom post type to handle user profile, and then create a side bar widget or something to submit the data,

    But if you want to save wpcf7 data, insert the below code inside your function.php file,

    Make sure you create your custom table,

    add_action('wpcf7_before_send_mail', 'save_application_form' );
    
    function save_application_form($wpcf7)
    {
        global $wpdb;
        $submission = WPCF7_Submission::get_instance();
        if ($submission) {
            $submited = array();
            $submited['title'] = $wpcf7->title();
            $submited['posted_data'] = $submission->get_posted_data();
        }
        $data = array(
            'name' => $submited['posted_data']['name'],
            'email' => $submited['posted_data']['email']
        );
        $wpdb->insert($wpdb->prefix . 'your_table_name', array(
            'form' => $submited['title'],
            'data' => serialize($data) ,
            'date' => date('Y-m-d H:i:s')
        ));
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员