Hello,

I have a (POST) web service to upload an image, store it in uploads 
directory and insert it in its correspondent table in my database (a 
typical functionality), and it's working correctly.
Now I would like to have a similar web service but, instead of store the 
image and insert it in the database, sends it attached to an email.
I've tried some things:

- Using the same code that in the first service I store the image in 
uploads directory but instead of inserting it in the database I send it 
attached to the email. But, it's not working, the email is not being sent I 
guess because the image is stored in uploads directory and this directory 
is "protected".
- Store the image in the static/images directory whit this code:
myimage=open('<path to my application>/static/images/myimage.jpg','w+')
myimage.write(photo)
myimage.close()

where photo is the argument of my POST request (I get it from request.vars 
as in my first service). 
But this code creates a corrupted file.

Are there any other alternatives to this? I can not find any recipe for a 
task like this. Should I use some kind of SQLFORM or something like that?

Any idea would be very appreciated.

Kind regards!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to