Developer forum

Forum » CMS - Standard features » File references in items

File references in items

Lars Pham
Reply

Hi..

After an 8.4.1.2 upgrade, I have problems with my file locations when using items, since I use image-files located in the default "images" folder and some images in my template folder. I get a "Filereferencer outside the base directory is not allowed", when saving an item with files from different folders. 

Before the upgrade I had no problems using images from multiple folders, but now it seems that I must define a startfolder when creating an item. 

Why can't I do this? It's quite a hassle to have to copy all my images to the same folder and relinking the filereferences for all my items again. 


Replies

 
Mikkel Ricky
Reply

All images (and other files) that are used in content (items and paragraph) should be placed in the Images (or Files) folder. The Templates folder is for templates and any images in this folder should only be used for design purposes in the templates, e.g. as background images.

In Dynamicweb 8.4.1 we made a change to ensure that only files inside the specified base folder on an item field can be used. In the long run this will help keep things tidy, but we know that it may require some cleaning up in your content.    

Best regards,
Mikkel

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

The exception to this rule is a site-wide icon that is selectable on the Website Settings for an area. Shouldn't that be part of the design so you can copy a complete design?

Imar

 
Lars Pham
Reply

Okay then, if I move around my images to the "Images" folder inside "File Archive" will the imagelinks from all of the items by corrected automatically or do I have to relink them all? 

 
Mikkel Ricky
Reply

No, the file references will not be updated automatically. You can update the image fields in the database by running a query like this

update ItemType_Something
set Image = replace(Image, '/Files/Template/Images/', '/Files/Images/')
where Image like '/Files/Template/Images/%'

Best regards,
Mikkel

 

 

You must be logged in to post in the forum