downloading photos functionality