Upload of binary files

Max M maxm at mxm.dk
Thu Mar 13 15:20:56 CET 2003


I used the cgi module under .asp, and the following code snippet is 
running. (I have removed unnessecary code.):

     # iisUtils.winFieldStorage is a subclass of the FieldStorage that
     # runs under IIS but works the same as FieldStorage

     import iisUtils

     req = iisUtils.winFieldStorage(Request)
     image = req['image']
     if image.file: # is there a file uploaded?
         filename = image.filename
         f = open('c:/path/to/files/folder/%s' % filename , 'wb')
         f.write(image.file.read())
         f.close()


I hope it is of any help.

-- 

hilsen/regards Max M Rasmussen, Denmark

http://www.futureport.dk/
Fremtiden, videnskab, skeptiscisme og transhumanisme





More information about the Python-list mailing list