This is a scenario that would only occur if XFile is being used to POST form elements to the server without including any files. This sometimes occurs in applications which provide users with a web form that includes an optional upload option, so that some requests contain only form elements. In such a scenario, XFile will default to a different form encoding type than is normally used for uploads. Since there are no files, it assumes that using "application/x-www-form-urlencoded" would be more efficient, as it doesn't require MIME boundaries in the POST.
The problem with this is that FileUp on the server does not recognize that type of encoding and will fail when attempting to parse the POST. In order to send only form elements with XFile and allow FileUp to successfully parse the request, it is necessary to manually set the FormEncType property of the XFRequest object.
Code Example:
SAXFile.RequestMethod = "POST";
SAXFile.FormEncType = "multipart/form-data";
SAXFile.CurrentURL = "http://[ServerName]/upload.aspx";
SAXFile.AddFormElement("TestKey", "TestVal");
SAXFile.Start();
|