Upload audio file

edited June 2015 in Modules
When i try to upload audio file using $audio_file->add_field('audio', array('type' => 'asset','overwrite' => TRUE, 'display_input' => TRUE)); I couldnt able to upload file since it is not saving in assets and db. Please kindly help

Comments

  • edited 11:38PM
    Apart from any possible coding errors, you'll probably find that the default settings on your web server has set the upload file size limit much lower than the average MP3 size. I'd double-0check that first...
  • edited 11:38PM
    You may also need to modify the fuel/application/config/mimes.php file to account for your audio file's mime type and/or add the the following to your fuel/application/config/MY_fuel.php file and modify the "assets" to include any extensions (note the {add_your_extensions_here}):
    // Specifies what filetype extensions can be included in the folders $config['editable_asset_filetypes'] = array( 'images' => 'jpg|jpeg|jpe|gif|png|zip|svg', 'pdf' => 'pdf|zip', 'media' => 'mov|mp3|aiff|mpeg|zip', 'assets' => 'jpg|jpeg|jpe|png|gif|mov|mpeg|mp3|wav|aiff|pdf|css|zip|svg|{add_your_extensions_here}' );
  • edited 11:38PM
    I added the above code in my_fuel.php. i am trying to upload mp3 file only. Still it is not working.
  • edited 11:38PM
    Is there an error message being displayed? Did you check that the proper mime type exists in the fuel/application/config/mimes.php file?
  • edited 11:38PM
    I am not receiving error. when i select file and click upload, it has not been uploaded.
  • edited 11:38PM
    This may be off-topic, but I've often had difficulties uploading using Codeigniter's upload class, and it can depend on how the browser identifies the MIME type? Would another browser allow the upload?

    I wrote up a technique to identify the MIME being used by the browser here. The problem I had wasn't to do with audio files, but it might help anyway.
  • edited 11:38PM
    'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3').
    Adding this in mimes for mp3 file is enough right?
  • edited 11:38PM
    It could also be an Apache limitation with the upload max file size. If that isn't set high enough, it may fail silently without an error message. To fix that issue, add the following to your .htaccess:
    php_value upload_max_filesize 10M php_value post_max_size 10M
    http://stackoverflow.com/questions/1122418/changing-upload-max-filesize-on-php

    Also, Gumster is right... I've run into this issue as well (e.g. I remember Firefox doing like a zip mime for PDFs or something a while back). I would check out his technique to identify the mime type first and see if it is included in the mimes.php config file.
  • edited 11:38PM
    Thanks. that works fine
Sign In or Register to comment.