Fixed bug and sImplified upload controller.

Now upload should work correctly.