Custom Fields
Re-Envisioned
Support Meta Box Group File type image or file not upload

  • Creator
    Topic
  • #30940
    Piero
    Participant

    I use a field to upload a file (type = file or image) within a group.

    N.b. I also use extension for custom table

    But the file is not uploaded what can I do?

    $meta_boxes[] = array(
        'title' => 'PORTFOLIO',
        'post_types' => ['page'],
        'storage_type' => 'custom_table',
        'table'        => 'IMAZ_agenzie',
    
    'fields' => array(
                         array(
                'id' => "portfolio",
                'type'   => 'group',
                    'clone'  => true,
                'sort_clone'=>true,
    
            'fields' => array(
                      array(
                        'id'   => "img",
                        'type' => 'image',
                        'max_file_uploads' => 1,
                        'force_delete'     => true,  
                        'name' => 'Immagine',    ),
    
                       ),
        ),
                ), 
    
    );
Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #30942
    Long Nguyen
    Moderator

    Hi Piero,

    Can you please share the code that creates the custom table? I do not see any issue with your code on my end.

    #30960
    Piero
    Participant
    array(
        'title' => 'PORTFOLIO',
        'priority' => 'low',
        'context' => 'after_title',
        'post_types' => ['page'],
    
    'storage_type' => 'custom_table',   
    'table'        => 'IMAZ_agenzie')
    #30969
    Long Nguyen
    Moderator

    Hi,

    The code that creates the custom table looks like this

    add_action( 'init', 'prefix_create_table' );
    function prefix_create_table() {
        if ( ! class_exists( 'MB_Custom_Table_API' ) ) {
            return;
        }
        MB_Custom_Table_API::create( 'my_custom_table', array(
            'address' => 'TEXT NOT NULL',
            'phone'   => 'TEXT NOT NULL',
            'email'   => 'VARCHAR(20) NOT NULL',
        ) );
    }

    Please refer to this documentation https://docs.metabox.io/extensions/mb-custom-table/#creating-custom-tables

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.