Upload a file to the Puush account.
        
        Parameters:
            * f: The file. Either a path to a file or a file-like object.

def upload(self, f):
        """Upload a file to the Puush account.
        
        Parameters:
            * f: The file. Either a path to a file or a file-like object.
        """
        if hasattr(f, 'read'):
            needs_closing = False
        else:
            f = open(f, 'rb')
            needs_closing = True
        # The Puush server can't handle non-ASCII filenames.
        # The official Puush desktop app actually substitutes ? for
        # non-ISO-8859-1 characters, which helps some Unicode filenames,
        # but some are still let through and encounter server errors.
        # Try uploading a file named åäö.txt through the desktop app -
        # it won't work. It's better to let this Python API do that,
        # however, with the behavior probably intended in the desktop app.
        filename = os.path.basename(f.name).encode('ascii', 'replace')
        filename = filename.decode('ascii') # Requests doesn't like bytes
        md5 = md5_file(f)
        
        data = {
            'z': 'meaningless',
            'c': md5
        }
        files = {
            'f': (filename, f)
        }
        
        res = self._api_request('up', data=data, files=files)[0]
        if res[0] == '-1':
            raise PuushError("File upload failed.")
        elif res[0] == '-3':
            raise PuushError("File upload failed: hash didn't match with "
                "the file the server received.")
        
        if needs_closing:
            f.close()
        
        _, url, id, size = res
        now = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        return self._File(id, url, filename, now, 0)