Fixed upload issue when free space is not known (ex: FTP)

Fixed upload issue when free space is not known

This is an issue on __master only__, introduced recently by the distinction between "filesize > maxupload" and "filesize > freespace".

I've also added unit tests for file upload to cover this case.

Please review @karlitschek @schiesbn @icewind1991 @MorrisJobke