Fixed upload bug and added jpg upload