fixed bug in file reader
refactored uploader.js