Transferring MP3 format to FTP using python

307 views Asked by At

I got an issue with transferring MP3 format or wav format from local to FTP. The music got distorted or even blank sounds.

I used session.storbinary('STOR '+ fileName, fileOpen) which causes the sound distortion. Is there any other way to transfer the files over? Or I have to do it manually?

I'm using python with ftplib.

1

There are 1 answers

1
George On BEST ANSWER

Make sure to open your local files like this:

f = open('something.mp3', 'rb')

Using open('asd.mp3') will treat the file as text and result in corruption. Now, I can't be sure this is the problem, but without more context this is my closest bet.