In this scenario where i transfer a file in uploads folder i have a problem.

I cannot see or download the file via
http://127.0.0.1:8000/CrossValidation1/appadmin/download/db/ico1.gif

The ico1.gif is there but i get the error 404 Not found

So i cannot create a link in my app to that file.

What is the problem?
best regards
António



2010/11/25 mdipierro <mdipie...@cs.depaul.edu>

> This reads the entire file in ram. Only ok for small files. May be a
> vulnerability if anybody can access this service.
>
> On Nov 24, 5:16 pm, António Ramos <ramstei...@gmail.com> wrote:
> > i got xmlrpclib to transfer a file from python script to web2py app
> >
> > Here is my code
> > *Python script*
> > import xmlrpclib
> > server = xmlrpclib.ServerProxy('
> http://127.0.0.1:8000/CrossValidation1/default/call/xmlrpc')
> > filepath='c:\\'
> > filename='ico.gif'
> > filebin = xmlrpclib.Binary(open(filepath+filename).read())
> > server.checkflow(filebin,filename)
> > *
> > and in my default.py controller*
> >
> > import xmlrpclib
> >
> > import os
> > @service.xmlrpc
> > def checkflow(file,name):
> >     basedir= request.folder.replace('/','')
> >     f=open(basedir+'\\uploads\\'+name,'wb')
> >     db.image.insert(file=name)
> >     f.write(file.data)
> >     f.close()
> >     print "ok"
> >     return name
> >
> > def call():
> >     session.forget()
> >     return service()
> > *
> > my model*
> > *
> > *db.define_table('image',
> >     Field('file','upload'))
> >
> > Is this a good practice?
> >
> > 2010/11/24 mdipierro <mdipie...@cs.depaul.edu>
> >
> > > No
> >
> > > filename = request.vars.varwithFile.filename or 'filename.txt'
> > > stream = request.vars.varwithFile.file or open(filename,'rb')
> > > db.photo.insert(file=db.photo.file.store(stream),filename=filename)
> >
> > > On Nov 24, 3:37 pm, António Ramos <ramstei...@gmail.com> wrote:
> > > > but if  i want, using the shell, to add and image manually
> > > > do i use
> > > > db.photo.insert('file'=varwithFile)
> > > > ?????
> >
> > > > *my test model is
> > > > db.define_table('photo',
> > > >     Field('file','upload'))*
> >
> > > > Best regards
> > > > António
> >
> >
>

Reply via email to