1

I have a file input element on my HTML page like so :

input type="file"

which receives the path to an image file chosen by the user.

I need to pass this image to a python script for the remainder of the processing. How do I go about doing this? I'm familiar with CGI and its working. I am unclear on how I would send the image per se.

Thanks for your help!

3
  • 1
    possible duplicate of Upload a File with Python Commented Apr 11, 2015 at 14:53
  • 1
    Please add the relevant code that you have now including the whole HTML form Commented Apr 11, 2015 at 15:33
  • @twil, this was not EXACTLY my problem, but the solution was along the lines of what I needed. Thank you! Commented Apr 12, 2015 at 18:43

1 Answer 1

2

You have to set the "enctype" field:

<form enctype="multipart/form-data" action="save_file.py" method="post">

in your HTML form. it is unclear whether you did or not, since you only provided partial information. Please have a look at http://webpython.codepoint.net/cgi_file_upload for a detailed explanation on how to proceed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.