No cookie thing should not be there. cookie settings where thrown in the database from your config file. If they where not correct you would now need to view your settings table in phpmyadmin and correct them as needed settings 171-173
As far as upgrade and filenames it would seem to me looking at that error that you ran step 3 of the 485-486 upgrade script twice prepending the userid's to the filenames twice. If this is the case you would need to restore a backup of the photos tables and redo the upgrade only running the step once.