added checking if uploaded file exists