ciao a tutti ho la necessità di realizzare uno script che effettui il download di files di svariato tipo, musicali, immagini, testo ecc ecc con mod_python ma non riesco a capire se è fattibile e come.
Fin'ora ho sempre effettuato queste operazioni tramite cgi in python con il seguente codice: naturalmente modificando il Content-Type in base al tipo di file da scaricare. print 'Content-Type: x-music/x-midi' print 'Content-Disposition:attachment; filename=filename' print 'Content-Length: %s' % os.path.getsize(path) print a = msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) while True: chunk = f.read(8192) # segments of 8192 bytes if not chunk: # if end of file break sys.stdout.write(chunk) # send segment sys.stdout.flush() # flush f.close()
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python