nlv11281 at natlab.research.philips.com
Wed Jan 24 04:51:46 EST 2007
> 1.When a user uploads file, using FORM ( POST method), is there a possibility to stop > uploading, if the file extension is not among those allowed? Yes. Write out an error and close the HTTP connection. > 2. > Is there a good/recommended way how to find out the file extension? > I use a handler that can find the extension( using util.FieldStorage(req)) > but it does not stop uploading in progress but uploads the whole file first. Create a FieldStorage instance, and pass it the callbacks for file processing. You'll be called while the file stream is being read, and you can check the extension at that time. Mike.