detect file automaticly