Simply assign a dummy value to
ext
variable when you declare it.
This way:
String ext = String.Empty;
Hope this helps.
[Edit]
If I were you, I would change the way I compare strings; specifically these lines:
if ( ext == ".mov")
else if (ext == ".jpg")
which I would translate to:
if (ext.Equals(".mov", StringComparison.InvariantCultureIgnoreCase))
else if (ext.Equals(".jpg", StringComparison.InvariantCultureIgnoreCase))
repectively.
[/Edit]