Missing Images

Victor Subervi victorsubervi at gmail.com
Sat Dec 26 10:28:58 EST 2009


For some reason, I'm not able to upload images to insert into my database.
Here's my html:

    <td>Picture #1</td>
    <td>
<input type="file" name="pic0" />
    </td>
  </tr><tr>
    <td>Picture #2</td>
    <td>
<input type="file" name="pic1" />
    </td>

Here's the code from the page that processes the data from the preceding
form:

  i = 0
  for picsStore, num in pics().iteritems():
    if picsStore == store:
      numPics = int(num)
  while i < numPics:
    y += 1
    pic = form.getfirst('pic%d' % i)
    try:
      if len(pic) > 0:
        ourPics.append(pic)

The output, however, when I print out ourPics, is just the names of the
images (e.g., "image.jpg"). I haven't included complete code because it
appears to me that my code is working perfectly well, but I've simply not
coded to achieve my goal which, obviously, is to capture the image itself,
not its name. What have I missed?
TIA,
beno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091226/0e6f3243/attachment-0001.html>


More information about the Python-list mailing list