Your app also works in my VM. Both views show a FieldStorage object for POST['profile_picture']
Hmm, confused. One difference I can see between the two is you use waitress to serve it, I'm using pserve. I've not heard of waitress until now. Is there a possibility that pserve could be the reason I'm having problems? Craig On Feb 8, 1:22 pm, Chris McDonough <chr...@plope.com> wrote: > Can't replicate. This app tries to do so but using either "/broken" or > "/works", it returns the same result (a repr of the FieldStorage) on > Pyramid 1.3a7: > > from waitress import serve > from pyramid.config import Configurator > from pyramid.response import Response > from pyramid.view import view_config > > @view_config(name='works') > def works(request): > form = """ > <html> > <form action="/works" method="POST" enctype="multipart/form-data"> > <input type="hidden" name="csrf_token" value="token"/> > <input type="file" name="profile_picture" value=""/><br/> > <input type="submit" value="save picture"/> > </form> > </html> > """ > if request.method == 'GET': > return Response(form, content_type='text/html') > else: > picture = repr(request.POST['profile_picture']) > return Response(picture, content_type='text/plain') > > @view_config(name='broken') > def broken(request): > form = """ > <html> > <form action="/broken" method="POST" enctype="multipart/form-data"> > <input type="file" name="profile_picture" value=""/><br/> > <input type="hidden" name="csrf_token" value="token"/> > <input type="submit" value="save picture"/> > </form> > </html> > """ > if request.method == 'GET': > return Response(form, content_type='text/html') > else: > picture = repr(request.POST['profile_picture']) > return Response(picture, content_type='text/plain') > > if __name__ == '__main__': > config = Configurator() > config.scan('__main__') > serve(config.make_wsgi_app()) > > > > > > > > On Wed, 2012-02-08 at 12:15 -0800, Craig Swank wrote: > > Forgot to add environment info > > pyramid: 1.3a6 > > python: 2.7 > > os: ubuntu on a vagrant VM on a mac. > > > On Feb 8, 1:03 pm, Craig Swank <craigsw...@gmail.com> wrote: > > > Hello, > > > I just got wailed on by a file upload for about an hour. Does anyone > > > know why, when I post this form to my pyramid app: > > > > <form action="${save_picture_url}" method="POST" enctype="multipart/ > > > form-data"> > > > <input type="file" name="profile_picture" value=""/><br/> > > > <input type="hidden" name="csrf_token" value="${csrf_token}"/> > > > <input type="submit" value="save picture"/> > > > </form> > > > > the request.POST['profile_picture'] is an empty string. When I move > > > the position of the csrf_token field like this: > > > > <form action="${save_picture_url}" method="POST" enctype="multipart/ > > > form-data"> > > > <input type="hidden" name="csrf_token" value="${csrf_token}"/> > > > <input type="file" name="profile_picture" value=""/><br/> > > > <input type="submit" value="save picture"/> > > > </form> > > > > Then request.POST['profile_picture'] is a FieldStorage object as > > > expected. > > > > Craig -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com. To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.