making the file upload/download more robust... still working it out...