Uploading an image file from a web form

S

Shufen

Hi all,

I have a form where users can use it to upload images into a file and
save it into a directory.

I have installed PIL and Image module and do a fair bit of reading on
these module. But I don't know how can I use python to get the
uploaded image file from the form.

Can I use something like that:

######################################################
im_file = form["userfile"]

######################################################

im = Image.open(im_file)
im.show()

####################################################

Can someone help? Many thanks....


Shufen
 
P

Peter L Hansen

Shufen wrote:
[snip question regarding uploading files via the web]
Can someone help? Many thanks....

You haven't indicated what web framework you are using.
That is, what are you using to cause your Python code
to be executed on the server when the user clicks on
the "upload" button (or whatever it will be called) in
the web page?

If you haven't *got* a web framework, then the answer to
your question is "go get one". ;-)

If your next question is "which one should I get?", the
answer is probably "have you checked with Google yet?"...
There are many and frequent discussions about this topic
in the newsgroup, so the archives should help you out, and
there are also numerous web pages discussing the various
options.

-Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top