debugged photo upload scripts