Block layout

edited May 2015 in Feature Requests
$video->add_field('video', array('type' => 'file', 'accept' => 'mp4', 'upload_path' => assets_server_path('media'), 'overwrite' => TRUE));

I used the above code to upload video file in blocks. In dshboard, when i choose file and click save, that file has not be saved. Can anyone help me to solve this issue.

Comments

  • edited May 2015
    Is this code from a page layout? Also, is the assets/media folder writable and/or are you seeing any errors displayed. Also, if it is a video and large file, you may need to modify your .htaccess file to increase the maximum upload file size. If it's too low, it will fail without throwing an error message.
    #maximum file size for uploading php_value upload_max_filesize 10M
  • edited 6:51AM
    Ya. thanks. but when i upload video using above code the file has been uploaded in assets folder and the file name is not stored in db
  • edited 6:51AM
    That field will create a file field type which only uploads a file. You can specify the "display_input" parameter to TRUE on it which will create a field with the name of video that can be used to store the value to the database (currently not displayed in the documentation).
  • edited 6:51AM
    can you please explain where is that parameter located? which file?
  • edited 6:51AM
    $media_video->add_field('video', array('type' => 'file', 'accept' => 'mp4', 'upload_path' => assets_server_path('media'), 'overwrite' => TRUE, 'display_input' => TRUE));
    I tried this code. Using select asset field, it uploads only images not video.
  • edited 6:51AM
    The example you provided is the correct location to put "display_input" => TRUE. The file input field should also have an associated input field now.

    To be able to upload the mp4 file type, you will need to modify the "editable_asset_filetypes" configuration. This can be done by adding the following in the fuel/application/config/MY_fuel.php:
    // 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|mp4' );
  • edited 6:51AM
    $pdf_file->add_field('pdf', array('type' => 'asset'));
    I have given this to upload an asset (PDF file). Two buttons are displayed select image and upload asset. I need to have only the upload asset button and remove the select image button. Kindly help.
  • edited 6:51AM
    Set "select" => FALSE:
    $pdf_file->add_field('pdf', array('type' => 'asset', 'select' => FALSE));
  • edited 6:51AM
    That works fine. Thanks a lot
Sign In or Register to comment.