Urlencode json parameters for ajax calls

The json encoded files list needs to be urlencoded/decode otherwise it can happen that the list is broken after the ajax call. I could never reproduce this on my system but thanks to  @mbiebl I could reproduce it on his server and also test the patch there.

More information about the issue: #2290 

cc @icewind1991 please have a look to my changes in the files app to make sure that I didn't miss anything.