Try our conversational search powered by Generative AI!

Uplading images to Pagefiles while creating new page


I have a page type with a required image. The normal procedure for the user is to upload the image to "pagefiles" ("För följande sida in swedish). However is this not option available when creating the page (before its saved for the first time)! The user can not save the page first since the image is required. A catch-22. Or am I missing something?
(The user could use a dummy image or uplad to website prior, but this is not a good workflow)

Mar 24, 2014 11:12

Hi Sven,

Which version are you using? I ask because you mention the folder PageFiles, which in 7.5 has been replaced (the Media section was replaced in 7.5), see and

What you are asking is very possible without breaking the workflow.

1) Select "New Page". If the Image property has been set as Required, the first screen you will see will contain the Image property, which is set as required - as you pointed out.

2) Open the Assets pane on the right hand side.

3) Select the Media tab, and either Drag 'n' Drop, or click within the lower region to Upload the image.

4) The New Page dialog is still open on the left hand side, click on the Image property and select the image you just uploaded.

I see your point about the workflow. It would be nice if the Image UIHint allowed for both selection of an existing image, or uploading a new image. As you probably already know, additional UIHints can be developed, so if it's an absolute must for you, you could either create your own UIHint or suggest it is built in to the Core.

Hope this helps.

Edited, Mar 25, 2014 1:37

Hello Al and thanks for a fast reply :)

I have Episerver.core = 7.5.1003.0. I think I must clearify myself a bit. I'll use the proper english terms for the GUI-components this time.

Yes, It would be nice to be able to select and upload in same workflow (a good featrure request though), but my problem is not that. It is as you descrive perfectly fine to upload via the "media assets pane" however only for media on global site level, that is in the "For This Site" tree. It is more common that you want to add media/images to "For this Page" (what I ment with PageFiles).

"For This Page" is only available after creating the page. Thats a catch 22.

NAs it is now has the user upload the image to global level or select a dummy image on page creation. If dummy is used then swap the image after page is created.

I understand the problem by uploading to "page files" when then page has not been created, but is the most common scenario I think.

Mar 25, 2014 8:43

Hi Sven,

Ah ok - I see your issue now, that makes perfect sense. Unfortunately you're right, there's no way round this (that I know of anyway) because the "For this page" folder doesnt exist at the stage of creating the new page for the first time.

I have to say I dont often use the "For this page" / "PageFiles" folders - I tend to find that most of the time if a user is uploading an image/pdf there is a very strong chance that they will want to use that same asset on another page - if they upload it to the PageFiles folder then of course they cannot re-use it, in which case they often upload a duplicate, which creates different kinds of problems!

In your scenario I think you will have to accept that users will need to upload the assets to a different folder. There are probably other programmatical solutions that you could come up with, but I suspect most of them will feel like you are trying to bend EPiServer in a way that wasnt intended.

Sorry I couldn't provide a better solution!


Mar 25, 2014 10:36

95% of the time does the page has it own image (often an article) that works best if it is under "Page files".
This worked fine in Epi 6. Not everything is for the better in Epi 7 ;-S

Thanks for your time anyhow. Do you know how to post feature requests?

Mar 25, 2014 11:06

Al, I did think about this once more....

I think it's a quite strange workflow when adding a new page: First enter data for mandatory fields then come to the page and fill in the others (and change the mandatory fields). Why not the page directly and validation errors when saving the page. I would like to say that is a normal workflow.

When I was thinking about this did I come with an idea. My guess is that Episerver does this based on "Required" attribut. I have other attributes that validates image size etc. They are not mandatory and only validates when saving/publishing page.

I therefore created my own "Required" attribut. Changed to my new Reuired-attribute in the model and voila :) =>
Now does the "enter mandatory fields-page" not present itself. The required validation occurs on save/publish and best of all: I can now add images to "Page files" :)!!

Mar 26, 2014 9:38

Hi Sven,

Nice idea - so within your custom attribute did you check whether the object i.e. the page was null, which would indicate the user is on the first screen before having saved the page?


Mar 26, 2014 19:52

Right. This is mig Required attribute class (Has the same AllowEmptyStrings check ass the "original" Required. Can´t see when thats needed by I left it there to have the exact same code as the original:


[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
public class RequiredSFAttribute : ValidationAttribute
/// <summary>
/// Gets or sets a flag indicating whether the attribute should allow empty strings.
/// </summary>
public bool AllowEmptyStrings { get; set; }

public override bool IsValid(object value)
if (value == null)
return false;

// only check string length if empty strings are not allowed
var stringValue = value as string;
if (stringValue != null && !AllowEmptyStrings)
return stringValue.Trim().Length != 0;

return true;

Mar 27, 2014 8:07
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.