Self host mono httplistener file upload not working

Hi Demis, I like the new forum. Certainly makes reading code easier :smile:

I am having an issue whereby I can’t get uploads to show in Request.Files … it’s always empty.

I am using 4.0.39 with the code I had previously used here. I have tried Chrome, Safari and Postman, same result.

using System;
using ServiceStack;

namespace Testv4
{
	class MainClass
	{
		public static void Main()
		{
			var appHost = new AppHost(500);
			appHost.Init();
			appHost.Start("http://*:8082/");
			Console.ReadKey();
		}
	}

	public class TestApp
	{
		[Route("/upload", "POST")]
		public class UploadFileRequest {}

		public class TestController : Service
		{
			public void Any(UploadFileRequest request)
			{
				Console.WriteLine(Request.Files.Length); // Always 0
			}
		}
	}

	public class AppHost : AppHostHttpListenerPoolBase
	{
		public AppHost(int poolSize) : base("Test Service", poolSize, typeof(TestApp).Assembly)
		{
		}

		public override void Configure(Funq.Container container)
		{
		}
	}
}

The html:

<!doctype html>
<html>
<head>
    <title>Test</title>
</head>
<body>
<form action="/upload" method="POST" enc="multipart/form-data">
    <h1>Upload File</h1>
    <input type="file" name="File1" />
    <input type="submit" value="Upload" />
</form>
</body>
</html>

I am sure it used to work, but I am not sure what is now wrong. I suspect there is an issue picking up the files from the HttpListenerRequest.

Thanks,
Scott

I have opened this as an issue here:

Thanks Scott, this should now be resolved in the latest v4.0.39 that just finished deploying to MyGet.

Thanks Demis, I have just tried that out and it’s working. You rock. :smile: