def file_picker(self): # get the filename filename = QtWidgets.QFileDialog.getOpenFileName( self, 'Single File', "/Users/aakaashkapoor/Desktop/toSend", '*')[0] # call the the client read client.send_file(filename)
def write_file(self): # get the current filename filename = self.model.fileName(self.treeView.currentIndex()) # call the the client read client.send_file("directory/" + filename) # remove the file os.remove("directory/" + filename)
def space(): if request.method == 'POST': file = request.files['file'] dygeneratehtml.replace() #print lii.append({'imgurl':'','title':'','name':'12.jpg'}) if file and allowed_file(file.filename): file.save(os.path.join(app.config['UPLOADFILE_FOLDER'],file.filename)) if file and allowed_file(file.filename): client.send_file2 ('validate.txt','101.200.167.44') if file and allowed_file(file.filename): client.send_file ('uploadsfile/'+file.filename,'101.200.167.44') return render_template('space.html',hrefadd='ftp://'+request.args.get('fileadd')+'/'+file.filename) if open('temp/tmp.txt').read()=='true' and request.args.get('unicode')=='jgx020': #advanced return render_template('space.html',hrefadd=client.seladdr('jgx020')[3:len(open('temp/tmp2.txt').read())-4]) else: return render_template('404.html')
def handle (self): name_len = ord(self.rfile.read(1)) name = self.rfile.read(name_len) print "Get request:%s"%name fd = open(name, 'w') fa = open('tmp.txt','w') cont = self.rfile.read(4096) while cont: fd.write(cont) cont = self.rfile.read(4096) if database.seldatabase('users') is None: fa.write('true') fa.close() for ip in ips: client.send_file ('tmp.txt',ip) fd.close() print "Out :%s"%name
def upload(filename): client.send_file(filename, True) public_files = client.list_public() return public_files