9

I am currently developing a module where I am using the Sitecore Upload window. Most of the implementation of the Upload window is the same as the one of Package Installation Wizard.

The issue is that when I click on the Upload button, it open the window however, I get Document Not Found.

enter image description here

The code is as follows:

public static void Upload(ClientPipelineArgs args, Edit fileEdit)
{
    if (!args.IsPostBack)
    {
        UploadForm.Show(ApplicationContext.PackagePath, true);
        args.WaitForPostBack();
    }
    else
    {
        if (!args.Result.StartsWith("ok:", StringComparison.InvariantCulture))
            return;
        string[] strArray = args.Result.Substring("ok:".Length).Split('|');
        if (strArray.Length < 1 || fileEdit == null)
            return;
        fileEdit.Value = strArray[0];
    }
}

The code for the Show Method

public static void Show(string directory, bool postback)
{
    Assert.ArgumentNotNull(directory, "directory");
    Context.ClientPage.ClientResponse.ShowModalDialog(GetUrl(directory), postback);
}

And this calls the GetUrl Method

private static string GetUrl(string directory)
{
    Assert.ArgumentNotNull(directory, "directory");
    var urlString = new UrlString(Constants.UploadFileApp);
    urlString.Append("di", ApplicationContext.StoreObject(directory));
    return urlString.ToString();
}

The Constants.UploadFileApp has the path /sitecore/shell/applications/package generator/upload/uploadfile.

In the Core DB, the path of the uploadfile is /sitecore/content/Applications/Package Generator/Upload/UploadFile

EDIT 1 This is how the url is being changed enter image description here

13
  • 4
    Do you have a typo somewhere? Your screenshot says uploadfiledi
    – Kasper
    Commented Oct 11, 2016 at 9:56
  • I thought this was the issue but from the Network Tab on inspect element, the url format is correct, then a 302 redirection is done and remove the (?) Commented Oct 11, 2016 at 9:58
  • I have updated the question with the screenshot of the network tab Commented Oct 11, 2016 at 10:01
  • Which version of Sitecore are you on? Commented Oct 11, 2016 at 10:16
  • It is Sitecore v7.2 rev 141226 Commented Oct 11, 2016 at 10:17

2 Answers 2

2

I have figured out what was the issue.

Brief Problem Description

I have been using the same code as the one for the Sitecore Installation Wizard upload UI. The only modification done in the implementation is that instead of reading the the ASPX page, I have created an item which is mapped onto the ASPX page and also, it should allowed only CSV file to be uploaded instead of Zip file.

Solution

The issue was due to the path I had specified in the Frame SRC

 private void Page_Load(object sender, EventArgs e)
 {
     this.Upload.Attributes["src"] = Constants.UploadFileApp + WebUtil.GetQueryString();
 }

The Constants.UploadFileApp value is

/sitecore/shell/applications/package generator/upload/uploadfile

I should have use the following path

/sitecore/shell/applications/package generator/upload/uploadfile2

Because of this, it causes the Form to redirect to itself hence causing the Error Code 302 as shown in the Inspect Element Network Tab in the question.

So, I had only need to change the above code to the one below:

 private void Page_Load(object sender, EventArgs e)
 {
     this.Upload.Attributes["src"] = Constants.UploadFile2App + WebUtil.GetQueryString();
 }

where Constants.UploadFile2App has the path

/sitecore/shell/applications/package generator/upload/uploadfile2

PS:Sorry for missing some information in the question

1

You have to provide more information, are you creating your own dialog, or you want to change existing dialog functionality, if so you have to change inheritance of existing dialog aspfx file, so it points to your own code functionality.

For instance for fileUpload

<%@ Page language="c#" CodeBehind="Upload.aspx.cs" AutoEventWireup="false" Inherits="SitecoreClient.sitecore.shell.Applications.Upload.UploadPage" %>

it has to be pointing to your project namespace and class.

1
  • I have used the same code as Sitecore used to develop the Upload Wizard. I have also posted the answer why I had the document not found issue Commented Oct 12, 2016 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.