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

Uploadify: RemoveFile/AttachExisitingFile doesn't work as Content Author


Go to End


2 Posts   1566 Views

Avatar
oleze

Community Member, 65 Posts

22 October 2010 at 4:17am

I've got these two problems with FileUploadFields on my recent project. If I'm logged in as admin, there are no problems, when I'm Content Author, I get two errors:

If I want to remove a file from my page I get:
Error: Uncaught Exception: Object->__call(): the method 'removefile' does not exist on 'ReadonlyField'

(There are several ReadonlyFields from the translation and one I created for myself)

If I want to add an existing file, the field doesn't show the contents of the selected folder and throws an HTTP Error (500).
Has anyone those errors too?

Here's the code:

// Adding a Simulation
 	 		$simulation = new FileUploadField('Simulation',_t('VEHICLEPAGE.SIMULATION','Simulation'));
 	  			$simulation->removeFolderSelection();
 				$simulation->uploadFolder = 'simulations/'.$this->URLSegment;
 				$simulation->setFileTypes(array('zip'),_t('VEHICLEPAGE.ZIPS','ZIPs'));
 			$fields->addFieldToTab("Root.Content.AttachedFiles", $simulation);
 			$fields->addFieldToTab("Root.Content.AttachedFiles", new TextField('Simulation_URL',_t('VEHICLEPAGE.SIMULATIONURL','Simulation_URL')));
 			
 	  
 	  	$fields->addFieldToTab("Root.Content.AttachedFiles", new ReadonlyField(
   			$name = "hinweis2",
   			$title = "ACHTUNG",
   			$value = "Simulationen muessen gezippt werden, sonst kann kein Upload erfolgen."
		),'Simulation');

Avatar
oleze

Community Member, 65 Posts

22 October 2010 at 11:49am

Edited: 22/10/2010 11:52am

If I choose my existing folder, the error appears while loading

http://www.urltomysite.com/admin/EditForm/field/Brochure/importlist?FolderID=27

I can only figure this out on the translated versions of the page.