fixed the upload code to make it wordpress-4 compatible and fixed upload code