#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    346
    Rep Power
    0

    ftp corrupting file?


    my code is:
    Code:
    from VideoCapture import Device
    from ftplib import FTP
    
    cam = Device()
    
    #while 1:    
    cam.saveSnapshot('image.jpg')
    myftp = FTP("neo.nocdirect.com", "usrnme", "pswd")
    myftp.cwd("public_html/work") #if needed
    myfile = open("image.jpg",'r')
    myftp.storbinary("STOR image.jpg",myfile)
    myfile.close()
    myftp.quit()
    #raw_input()
    it stores the image locally fine, but the picture on the server is corrupted and cannot be displayed for some reason.

    Any ideas?
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    206
    Rep Power
    12
    what about
    Code:
    myfile = open("image.jpg",'rb')
    instead of
    Code:
    myfile = open("image.jpg",'r')
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    346
    Rep Power
    0
    thanks

IMN logo majestic logo threadwatch logo seochat tools logo