It works! Thanks.

On Oct 21, 6:26 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Try
>
> db.videodata.insert(flvcopy=db.videodata.flvcopy.store
> (request.vars.Filedata.file,'test1.flv'))
>
> On Oct 21, 2:13 am, Adi <aditya.sa...@gmail.com> wrote:
>
> > Here's an update:
>
> > The POST request when seen as text looks like this:
>
> > ------------cH2Ij5cH2ae0gL6Ef1ae0cH2KM7ae0
> > Content-Disposition: form-data; name="Filename"
>
> > test video.flv
> > ------------cH2Ij5cH2ae0gL6Ef1ae0cH2KM7ae0
> > Content-Disposition: form-data; name="Filedata"; filename="test
> > video.flv"
> > Content-Type: application/octet-stream
>
> > ...video content here in junk chars...
> > ------------cH2Ij5cH2ae0gL6Ef1ae0cH2KM7ae0
> > Content-Disposition: form-data; name="Upload"
>
> > Submit Query
> > ------------cH2Ij5cH2ae0gL6Ef1ae0cH2KM7ae0--
>
> > It looks like a form submit. My web2py code is this:
>
> > def upload():
> >     """
> >     uploads an flv file to server, creates a database entry for it.
> >     """
> >     db.videodata.insert(flvcopy=db.videodata.flvcopy.store
> > (request.vars.Filedata,'test1.flv'))
>
> > but this gives me an error I cannot understand.
>
> > Traceback (most recent call last):
> >   File "gluon/restricted.py", line 184, in restricted
> >   File "C:/Home/Software/Development/web2py/applications/videotag/
> > controllers/default.py", line 72, in <module>
> >   File "gluon/globals.py", line 102, in <lambda>
> >   File "C:/Home/Software/Development/web2py/applications/videotag/
> > controllers/default.py", line 70, in upload
> >   File "gluon/sql.py", line 2357, in store
> >   File "shutil.pyc", line 21, in copyfileobj
> >   File "cgi.pyc", line 548, in __getattr__
> > AttributeError: read
>
> > Any help here?
>
> > On Oct 21, 11:45 am, Adi <aditya.sa...@gmail.com> wrote:
>
> > > Tried this once - it stores entire request as text. Trying to figure
> > > out a way.
>
> > > On Oct 20, 10:14 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > Sorry, I am not familiar with flash but this is wrong anyway:
>
> > > > return SQLFORM(db.videodata, fields=['flvcopy']).accepts(request.vars,
> > > > formname=None)
>
> > > > because it should return the form. It would only return True/False
> > > > from accept
>
> > > > I do not think flex is submitting to a form. I think you may need to
> > > > do something like
>
> > > > db.table.insert(field=db.table.field.store(request.body,'filename'))
>
> > > > Massimo
>
> > > > On Oct 20, 11:13 am, Adi <aditya.sa...@gmail.com> wrote:
>
> > > > > Any help on this?
>
> > > > > On Oct 20, 12:05 pm, Adi <aditya.sa...@gmail.com> wrote:
>
> > > > > > Hi,
>
> > > > > > I'm developing an application that uses web2py for server and 
> > > > > > air+flex
> > > > > > for user interface. Also, I'm a newbie.
> > > > > > The query is related to this 
> > > > > > post:http://groups.google.com/group/web2py/msg/b1c6d74aead0a401
>
> > > > > > I'm trying to upload a video file throughFlex. NowFlexwill send the
> > > > > > request in this format:
>
> > > > > >     Content-Type: multipart/form-data; boundary=AaB03x
> > > > > >     --AaB03x
> > > > > >     Content-Disposition: form-data; name="Filedata";
> > > > > > filename="example.flv"
> > > > > >     Content-Type: application/octet-stream
> > > > > >     ... contents of example.flv ...
> > > > > >     --AaB03x--
>
> > > > > > I tried to use this code for upload:
>
> > > > > > def upload():
> > > > > >     """
> > > > > >     uploads an flv file to server, creates a database entry for it.
> > > > > >     """
> > > > > >     # reference:http://bit.ly/remoteupload
> > > > > >     return SQLFORM(db.videodata, fields=['flvcopy']).accepts
> > > > > > (request.vars, formname=None)
>
> > > > > > where "flvcopy" is the file upload field. However, this is creating 
> > > > > > a
> > > > > > new record with all fields as "None" and "flvcopy" having nothing 
> > > > > > (not
> > > > > > even None).
>
> > > > > > How do I match my server code to upload the given request?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to