It looks like you're new here. If you want to get involved, click one of these buttons!
CREATE TABLE IF NOT EXISTS `special_offers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The name of the project',
`slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'If left blank, one will automatically be generated for you',
`description` text COLLATE utf8_unicode_ci NOT NULL,
`launch_date` date DEFAULT NULL,
`image` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`pdf` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`precedence` int(11) NOT NULL DEFAULT '999' COMMENT 'The higher the number, the more important',
`published` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
$fields['pdf'] = array('label' => 'PDF file', 'type' => 'file', 'upload_path' =>assets_server_path('special_offers', 'pdf'), 'overwrite' => TRUE);
Comments
http://www.getfuelcms.com/user_guide/libraries/form_builder
I'm trying to do it in a module so I have something in a projects_model.php
was hoping that 'accept' => 'mp4' would do it, but no go.
in my form_fields function:
$fields['video_mp4_upload'] = array('type' => 'file', 'accept' => 'mp4', 'upload_path' => assets_server_path('videos'), 'overwrite' => TRUE); $fields['video_mp4_upload']['order'] = 6; $fields['video_ogg_upload'] = array('type' => 'file', 'accept' => 'ogg', 'upload_path' => assets_server_path('videos'), 'overwrite' => TRUE); $fields['video_ogg_upload']['order'] = 8;
It does work with images, but not video formats.
Thanks,
Dustin
I'm looking into this. Questions for you though:
1. When you say 'no go' do you mean that you are getting an error on upload, or that your browser won't let you select the mp4 file to upload?
2. What browser are you using?
http://www.getfuelcms.com/user_guide/general/configuration
no error is shown.
the browser lets me select the image and it shows the file that i'm going to upload. It's when i hit save that it fails with no notice as to why.
I'm using the http://www.getfuelcms.com/demo/showcase example and added the uploads for my videos to the module.
so i'm wondering whats the trigger that tells it that its an image vs any other file. because I can upload a jpg and it goes into the correct directory that i'm wishing. Is there something in the input that I can change it to "media" rather than an "image".
I see that it's rendering out the image accept data
so where is 'images', 'pdf',and 'media' used
<input type="file" name="video_mp4_upload" id="video_mp4_upload" value="" accept="gif|jpg|png">
I added the mp4 to it
$config['editable_asset_filetypes'] = array('images' => 'jpg|jpeg|jpe|gif|png', 'pdf' => 'pdf', 'media' => 'jpg|jpeg|jpe|png|gif|mov|mp3|aiff|pdf|mp4|ogv');
double checked the size
$config['assets_upload_max_size'] = '10000'; //was 1000
2. testing mostly in firefox 3.6 & chrome 8.0
1. You are likely missing the mime for mp4 in your mime.php config file. Add this to the array:
'mp4' => 'video/mp4',
2. FuelCMS is trying to sanitize the file as an image and check for xss. One of these 2 is failing against the mp4 file. As a quick fix, I'm skipping the check for any media file.
[line 1286] /fuel/modules/fuel/controllers/module.php if ($this->sanitize_images AND xss_clean($tmp_file, TRUE) === FALSE AND $asset_dir != 'media')
UPDATE: Adding "sanitize_images" => FALSE to the form field fixes the second problem.
http://www.getfuelcms.com/user_guide/modules/simple
Thanks
if (in_array($this->file_type, $mime, TRUE))
{
return TRUE;
}
When I run, the value of $this->file_type was 'application/octet-stream', and for example the $mime variable have all the mimes referent to the extension (in my case all mime types of zip extension).
To get a factible solution, just add the 'application/octet-stream' to the array of the mime type, on the file 'fuel/application/config/mimes.php', just like this:
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/octet-stream')
I hope this works for anyone. Works for me!.
I created a folder "ebooks" and I'm trying to upload a PDF and Excel file to the folder and it is still giving me this error: "The filetype you are attempting to upload is not allowed."
$config['editable_asset_filetypes'] =
array(
'images' => 'jpg|jpeg|jpe|gif|png',
'pdf' => 'pdf',
'Excel' => 'xls',
'media' => 'jpg|jpeg|jpe|png|gif|mov|mp3|aiff'
);
'ebooks' => 'xls|pdf',
This is exactly what I have:
$config['editable_asset_filetypes'] =
array(
'images' => 'jpg|jpeg|jpe|gif|png',
'pdf' => 'pdf',
'ebooks' => 'xls|pdf',
'media' => 'jpg|jpeg|jpe|png|gif|mov|mp3|aiff'
);
'media' => 'jpg|jpeg|jpe|png|gif|mov|mp3|aiff|pdf|css|pdf|xls'
LIKE futbolsalso15 said it's in the codeigniter..
Fuel 0.93
/fuel/codeigniter/libraries/upload.php file..
line 199.. echo $_FILES[$field]['type'] . "
\n";
I get "image/pdf" as a file type.... odd...
I also found an article that says each browser has a different mime type for uploading PDF.. I'm using FireFox 22