Upload part of a file?

Paul Winkler slinkp23 at yahoo.com
Wed Oct 11 17:01:51 EDT 2000


Hi,

I've asked about this on the zope list, but no-one seems to
know.
It's been suggested that I might be able to do it with a
separate CGI script which I could then call from my zope
site.

The question is:

Is there any way that I could have an html form with a
<input type=file> tag, which, when I submit it, does the
following:

1) start uploading the file

2) open the data RIGHT AWAY, BEFORE UPLOADING IS FINISHED
(ugh, might require threads?)

3) get some useful info from the file header ... example
using PIL:
>>> import Image
>>> thing = Image.open('name_of_file_being_uploaded', 'r')
>>>  height, width = thing.size

4)  Stop uploading - the information from step 3 is all I
wanted.


OR, another approach:

1) start uploading and then stop after, say, 1 KB
2) open the truncated file, ignoring the fact that most of
it is missing.

This is obviously more elegant, but I don't know if it can
work - from what I've seen, an HTTP download leaves nothing
behind if you interrupt it, and I assume upload works the
same way.  But maybe I can control that on the server end.

Off to browse python libs for useful stuff...

TIA for any help,

 
.................    paul winkler    ..................
slinkP arts:   music, sound, illustration, design, etc.
           web page:  http://www.slinkp.com
      A member of ARMS:   http://www.reacharms.com



More information about the Python-list mailing list