File type image or file not upload

Support MB Group File type image or file not upload

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #30940
    PieroPiero
    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',    ),
    
                       ),
        ),
                ), 
    
    );
    #30942
    Long NguyenLong 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
    PieroPiero
    Participant
    array(
        'title' => 'PORTFOLIO',
        'priority' => 'low',
        'context' => 'after_title',
        'post_types' => ['page'],
    
    'storage_type' => 'custom_table',   
    'table'        => 'IMAZ_agenzie')
    #30969
    Long NguyenLong 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 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.