uploading test\zaurus jpg to zaurus jpg as image uploading test\zaurus jpg to zaurus jpg as image uploading test\zoo-jan- jpg to zoo-jan- jpg as image uploading test\zopeoutline htm to zopeoutline htm as text done files uploaded for my site and on my current laptop and wireless broadband connectionthis process typically takes six minutesdepending on server load as with the download scripti often run this command from the local directory where my web files are keptand pass python the full path to the script when run this on linux serverit works in the same waybut the paths to the script and my web files directory differ +refactoring uploads and downloads for reuse the directory upload and download scripts of the prior two sections work as advertised andapart from the mimetypes logicwere the only ftp examples that were included in the second edition of this book if you look at these two scripts long enoughthoughtheir similarities will pop out at you eventually in factthey are largely the same--they use identical code to configure transfer parametersconnect to the ftp serverand determine file type the exact details have been lost to timebut some of this code was certainly copied from one file to the other although such redundancy isn' cause for alarm if we never plan on changing these scriptsit can be killer in software projects in general when you have two copies of identical bits of codenot only is there danger of them becoming out of sync over time (you'll lose uniformity in user interface and behavior)but you also effectively double your effort when it comes time to change code that appears in both places unless you're big fan of extra workit pays to avoid redundancy wherever possible this redundancy is especially glaring when we look at the complex code that uses mimetypes to determine file types repeating magic like this in more than one place is almost always bad idea--not only do we have to remember how it works every time we need the same utilitybut it is recipe for errors refactoring with functions as originally codedour download and upload scripts comprise top-level script code that relies on global variables such structure is difficult to reuse--code runs immediately on importsand it' difficult to generalize for varying contexts worseit' difficult to maintain--when you program by cut-and-paste of existing codeyou increase the cost of future changes every time you click the paste button +usage notethese scripts are highly dependent on the ftp server functioning properly for whilethe upload script occasionally had timeout errors when running over my current broadband connection these errors went away laterwhen my isp fixed or reconfigured their server if you have failurestry running against different serverconnecting and disconnecting around each transfer may or may not help (some servers limit their number of connections client-side scripting