• Resolved ppuerta


    I have a problem with the code, I use the function media_handle_sideload it goes perfectly to the wordpress media but it does not go up to the amazon s3, it is driving me crazy, can you help me

    // CODE HERE

    //Subir como media
    $file_array = array(
    “name” => basename($css_file),
    ‘type’ => wp_check_filetype($css_file), // get mime type of image file
    “tmp_name” => $css_file,
    ‘error’ => 0,
    ‘size’ => filesize($css_file) //returns image filesize in bytes
    $media_id = media_handle_sideload($file_array,0);
    $media_url = wp_get_attachment_url($media_id);

    //Guardamos la url para este term_id
    if($media_url) {
    update_option(DSW_OPTION_STYLE_URL . $term_id, $media_url);

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ppuerta


    Fixed, the problem was the MIME TYPE that when uploading a css file it gave “MIME type invalid” the solution is to enable the MIME type through code or install a plugin like Enhanced Media Library

    Plugin Author Delicious Brains Inc.


    Good to hear you fixed this yourself.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘media_handle_sideload not working s3’ is closed to new replies.