Revert "Revert "Mistakes fixed in Upload_model.php. Note the hard coded paths in assets/js/custom.js:135,140 and application/models/upload_model.php:21,29. They might need to change if picture upload doesn't work properly. Also, write folder permissions are needed for processing thumbnails""

This reverts commit fb15f2fd56c7fb77f84ea604cd40594926491b07.