Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

2.4.0 can't upload .f4v files to assets folder


Go to End


6 Posts   2805 Views

Avatar
x75

Community Member, 43 Posts

13 May 2010 at 3:47am

Hi, i upgraded a website to 2.4.0.
Now I can't upload .f4v Videos to the assets folder anymore (with DOM installed).
If I upload the file with a different extension and then try to change the file name I get the an error that the Extension is not allowed an a list of valid extensions. How can you change, extend that list?

[User Error] Uncaught ValidationException: Validation error writing a File object: Extension is not allowed (valid: , ace, arc, arj, asf, au, avi, bmp, bz2, cab, cda, css, csv, dmg, doc, docx, flv, gif, gz, hqx, htm, html, ico, jar, jpeg, jpg, js, m4a, m4v, mid, midi, mkv, mov, mp3, mp4, mpa, mpeg, mpg, ogg, pages, pcx, pdf, pkg, png, pps, ppt, pptx, ra, ram, rm, rtf, sit, sitx, swf, tar, tgz, tif, tiff, txt, wav, wma, wmv, xhtml, xls, xlsx, xml, zip, zipx). Object not written.
POST /admin/assets/EditForm/field/Files/item/153/DetailForm

Line 931 in /var/syscp/webs/hempen/httpdocs/sapphire/core/model/DataObject.php
Source

922 		$firstWrite = false;
923 		$this->brokenOnWrite = true;
924 		$isNewRecord = false;
925 		
926 		if(self::get_validation_enabled()) {
927 			$valid = $this->validate();
928 			if(!$valid->valid()) {
929 				// Used by DODs to clean up after themselves, eg, Versioned
930 				$this->extend('onAfterSkippedWrite');
931 				throw new ValidationException($valid, "Validation error writing a $this->class object: " . $valid->message() . ".  Object not written.", E_USER_WARNING);
932 				return false;
933 			}
934 		}
935 
936 		$this->onBeforeWrite();
937 		if($this->brokenOnWrite) {

Trace

    * DataObject->write()
      Line 867 of DataObjectManager.php
    * DataObjectManager_ItemRequest->saveComplexTableField(Array,FileDataObjectManager_Popup,SS_HTTPRequest)
      Line 296 of Form.php
    * Form->httpSubmission(SS_HTTPRequest)
      Line 134 of RequestHandler.php
    * RequestHandler->handleRequest(SS_HTTPRequest)
      Line 152 of RequestHandler.php
    * RequestHandler->handleRequest(SS_HTTPRequest)
      Line 152 of RequestHandler.php
    * RequestHandler->handleRequest(SS_HTTPRequest)
      Line 152 of RequestHandler.php
    * RequestHandler->handleRequest(SS_HTTPRequest)
      Line 152 of RequestHandler.php
    * RequestHandler->handleRequest(SS_HTTPRequest)
      Line 147 of Controller.php
    * Controller->handleRequest(SS_HTTPRequest)
      Line 283 of Director.php
    * Director::handleRequest(SS_HTTPRequest,Session)
      Line 127 of Director.php
    * Director::direct(/admin/assets/EditForm/field/Files/item/153/DetailForm)
      Line 127 of main.php

Thanks
Johannes

Avatar
UncleCheese

Forum Moderator, 4102 Posts

13 May 2010 at 5:01am

This actually isn't a DOM issue. It looks like SS is validating file extensions in 2.4.. see File::$allowed_extensions

It's a public variable, so you can probably just modify it with File::$allowed_extensions[] = "xxx";

Avatar
theoldlr

Community Member, 103 Posts

13 May 2010 at 9:08am

I'm glad I came across this... I am having the same problem uploading a file with userforms and I'd like to change the allowable extensions. Is there a way to add a wild card so that any file type could be uploaded?

Avatar
HansR

Community Member, 141 Posts

31 May 2010 at 10:54am

Edited: 31/05/2010 10:57am

Has anyone found a solution to this problem? My assets folders includes files in lots of different formats, e.g., .cpp, .lha, and I can't even save the folder name right now. I need to either be able to add valid file extensions, or disable extension checking for just the assets folder.

Hans

Avatar
theoldlr

Community Member, 103 Posts

31 May 2010 at 11:48am

I ended up using the SWFUpload module--it didn't restrict my file types. I was using an upload field via userforms module before.

Avatar
HansR

Community Member, 141 Posts

31 May 2010 at 5:05pm

Switching back to the SWFUpload module wasn't appealing, so I simply added the file types that I needed to sapphire/filesystems/File.php's allowed_extensions variable.

Hans