Try our conversational search powered by Generative AI!

Bug in EPiServer.Forms.Core.Data.GetPostedFiles when uploadig multiple files

Vote:
 

I noticed that you have prepared for multiple file uploads with the forms element, thres however a bug in EPiServer.Forms.Core.Data.GetPostedFiles

The input "rawData" looks like this with one and two uploaded files

1 file: rawData = "fileUrl#@fileName"

2 files: rawData = "fileUrl#@fileName|fileUrl2#@fileName2"

The GetPostedFiles-method works with 1 file but not with two.

Original code:

private IDictionary GetPostedFiles(string rawData)
    {
      Dictionary dictionary = new Dictionary();
      string[] strArray = rawData.SplitBySeparator("|");
      if (((IEnumerable) strArray).Count() == 0)
        return (IDictionary) dictionary;
      string empty1 = string.Empty;
      string empty2 = string.Empty;
      string str1 = "#@";
      foreach (string str2 in strArray)
      {
        int length = str2.IndexOf(str1);
        string str3 = rawData.Substring(length + str1.Length);
        string key = rawData.Substring(0, length);
        dictionary.Add(key, str3);
      }
      return (IDictionary) dictionary;
    }


the rows:  

string str3 = rawData.Substring(length + str1.Length);
string key = rawData.Substring(0, length);

should be

string str3 = str2.Substring(length + str1.Length);
string key = str2.Substring(0, length);

#172014
Edited, Nov 23, 2016 14:26
* 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.