Try a different USB cable. Not all USB cables can transfer files.
If your phone detected moisture in the USB port, which can occur in high humidity environments or if the phone came in contact with water, unplug the phone, wipe it dry, and gently shake it about 10 times with the USB port facing downward to remove moisture. Place it on a cloth to air dry, or use a fan to help dry it faster.
To test the USB port on your phone, connect your phone to a different computer.
To test the USB port on your computer, connect a different device to your computer.
To connect your phone to a car, projector, or other device, refer to the user manual that came with the device.
Check your computer
Windows PC
On your PC, check that Settings > Advanced system settings > Hardware tab > Device installation settings is set to automatically detect and install drivers for new devices.
Restart your PC.
Mac computer
Check that your computer is running Mac OS X 10.5 or later.