• Resolved Bodrosh

    (@vasyada2)


    Hello, thanks for the plugin. When sending files for api, the wrong file type appeared in the media files, solved the problem like this:
    In wp-content/plugins/woo-media-api/class-woocommerce-media-api-controller.php

    $request->set_body($decoded);
    $request->add_header('Content-Disposition', "attachment;filename=\"{$filename}\"");
    
    //BR added
    $br_content_type = ( ! empty( $request['mime_type'] ) ? $request['mime_type'] : "image/jpeg" );
    $request->remove_header('Content-Type');
    $request->add_header('Content-Type', $br_content_type);
    // . BR added
    
    $result = $media_controller->create_item( $request );

    Now when sending data in addition to fields ‘media_attachment’ and ‘media_path’ can specify ‘mime_type’, for example ‘image/gif’

    • This topic was modified 6 years, 3 months ago by Bodrosh.
  • The topic ‘Mime type media’ is closed to new replies.