Moved upload script from view to seperate file