[web2py] Re: upload field and IS_IMAGE

2016-08-19 Thread Kirill Shatalaev
пятница, 19 августа 2016 г., 3:48:12 UTC+4 пользователь 黄祥 написал: > > pls try : > requires = IS_EMPTY_OR([IS_LENGTH(16384), IS_IMAGE() ] ) > > best regards, > stifan > Man, thanks!!! I completely forgot about this validator. Need to sleep more... -- Resources: - http://web2py.com - http://w

[web2py] Re: upload field and IS_IMAGE

2016-08-18 Thread 黄祥
pls try : requires = IS_EMPTY_OR([IS_LENGTH(16384), IS_IMAGE() ] ) best regards, stifan -- 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

[web2py] Re: upload field type doesn't show in grid or smartgrid

2015-10-20 Thread 黄祥
yes, you are right, my bad, there is readable = False, set for the upload field type in the middle of somewhere (i couldn't found in the first place, but now target spoted and silenced :) ). best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http:

[web2py] Re: upload field type doesn't show in grid or smartgrid

2015-10-20 Thread Massimo Di Pierro
Should work. Can you provide an example of code to reproduce? On Monday, 19 October 2015 23:20:05 UTC-5, 黄祥 wrote: > > hi, > > i have upload field type doesn't show in grid or smartgrid, in the older > version i believe it shown by default. is it normal in the recent version > (2.12.3) not shown

[web2py] Re: upload field

2015-04-25 Thread 黄祥
perhaps you can use validators on form level. e.g. requires = IS_UPLOAD_FILENAME(extension='pdf') ref: http://web2py.com/books/default/chapter/29/07/forms-and-validators#Special-type-validators best regards, stifan On Saturday, April 25, 2015 at 10:28:10 PM UTC+7, KevC wrote: > > Hi! > > I want

Re: [web2py] Re: Upload field default value ?!!

2015-03-04 Thread António Ramos
You are right I wrote before checking again. Last time i checked, after removing the "required", the record could not be saved. Then checked the sqlite db via firefox plugin and still the required was set at the sqlite db. So far so good more on this later if problems. Thank u 2015-03-04 1

[web2py] Re: Upload field default value ?!!

2015-03-04 Thread Leonel Câmara
Humm required is set at the DAL level I don't see how this could create problems due to sqlite. -- 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 recei

[web2py] Re: Upload field custom manipulation

2014-08-05 Thread Kuba Kozłowicz
What does "writable=false if forms" mean and WHAT should I apply this to? And where should I plug this "URL('mydownload', ... ) into? Sorry, but I understand if you just write some web2py-specific code completely out of contex. It requires some explanation. W dniu niedziela, 3 sierpnia 2014 00:

[web2py] Re: Upload field custom manipulation

2014-08-05 Thread Kuba Kozłowicz
Ok so I've already figured out what you meant. I should set 'writable' attribute of this field in db_wizard.py to False in order to prevent this field from being overwritten in forms. Then change type from 'string' to 'upload' and apply URL('mydownload') to 'represent' attribute of this field

[web2py] Re: Upload field custom manipulation

2014-08-02 Thread Massimo Di Pierro
Than it is easy. make it writable=false if forms. Store your filename in the the upload field. But instead of URL('download',) use URL('mydownload',) Where: def mydownload(): fullname = os.path.join(os.path.join, 'private', request.args(0)) response.stream(fullname) On Wed

[web2py] Re: Upload field custom manipulation

2014-07-31 Thread Kuba Kozłowicz
f_invoice_file_path is location where the file is stored by myself, because I generate these files myself and I save them myself as well. It contains whole path to the file ( with the filename and its extension ). They are stored under "private" directory with the structure I described above. I

[web2py] Re: Upload field custom manipulation

2014-07-29 Thread Massimo Di Pierro
Let me understand this better f_invoice_file_path is the location where the file is supposed to be stored or is it the full path including the desired filename? Do you handle the file writing or should web2py do it automatically? On Tuesday, 29 July 2014 05:59:10 UTC-5, Kuba Kozłowicz wrote: >

[web2py] Re: Upload field and SQLFORM.grid problem / bug?

2013-05-22 Thread Anthony
> OK - this URL is produced by database administration interface > > http://localhost:8000/periodicke_cinnosti/appadmin/download/db/item.file.8f5a1d4f8f222113.6e61747572616c6c5f30332e706e67.png > appadmin adds the "db" arg to the URL so it knows which DAL connection to use -- this is not necess

[web2py] Re: Upload field with clear text filename

2012-12-30 Thread Alan Etkin
My bad: Assigning to a form.vars item before calling to .process() works The issue is that the first code posted by Joe tests for the boolean value of form.vars.upload (an instance of the file storage object) and that object always evaluates to False, so: if request.vars.update: is omitt

[web2py] Re: Upload field with clear text filename

2012-12-30 Thread Massimo Di Pierro
This form=SQLFORM(db.fileobject) if request.vars.upload: form.vars.filename = request.vars.upload.filename if form.process().accepted: ... should work. Please open a ticket. On Friday, 28 December 2012 03:15:52 UTC-6, Joe Barnhart wrote: > > I'm not sure why this is difficul

[web2py] Re: Upload field with clear text filename

2012-12-30 Thread Alan Etkin
El viernes, 28 de diciembre de 2012 06:15:52 UTC-3, Joe Barnhart escribió: > > I'm not sure why this is difficult, but I see many posts about this when I > search, yet none exactly work for me. This seems like it should be easy > but is surprisingly difficult in web2py. A possible workaround (

[web2py] Re: Upload field with clear text filename

2012-12-29 Thread Anthony
Setting writable to False is probably the best way to keep that field out of the form -- that's why I suggested setting the default value of the field instead. Does that not work? Anthony On Saturday, December 29, 2012 8:04:05 PM UTC-5, Joe Barnhart wrote: > > I was trying to keep the filename

[web2py] Re: Upload field with clear text filename

2012-12-29 Thread Joe Barnhart
I was trying to keep the filename out of the generated form since I want it set "automatically" in the process of uploading the document. Is there a better way to accomplish that? BTW, the test "if request.vars.upload" does not work. It returns "False" even if the upload field has been set.

[web2py] Re: Upload field with clear text filename

2012-12-28 Thread Anthony
I see. I think the problem is that you have set the writable attribute of the filename field to False. In that case, try setting the default value of that field: if request.vars.upload: db.fileobject.filename.default = request.vars.upload.filename form = SQLFORM(db.fileobject) Anthony On F

[web2py] Re: Upload field with clear text filename

2012-12-28 Thread Joe Barnhart
Hi Anthony -- I want the opposite of this -- I want the actual text filename, not the encoded one. The book example I followed did not work. -- Joe On Friday, December 28, 2012 2:18:24 AM UTC-8, Anthony wrote: > > Are you saying you want the name in the "filename" field to be encoded > into t

[web2py] Re: Upload field with clear text filename

2012-12-28 Thread Anthony
Are you saying you want the name in the "filename" field to be encoded into the string stored in the "upload" field so the file has the name in the "filename" field upon download? If so, then try: if request.vars.upload and request.vars.filename: request.vars.upload.filename = request.vars.f

[web2py] Re: upload field value reset on form failure of another field

2011-12-05 Thread Anthony
Other form elements aren't stored in the session -- when the form submission comes in, they are in request.vars, and they can be moved to form.vars and returned with the form (no need to put anything in the session). The file itself, on the other, cannot be returned with the form, so you have t

[web2py] Re: upload field value reset on form failure of another field

2011-12-05 Thread Wikus van de Merwe
So how does it work for other form elements? I'm guessing they are stored in session. So the way to go would be to store the uploaded file in session too and then on form resubmission check what to display. If file is in session the input field should look as on update of an existing object (i.

[web2py] Re: upload field value reset on form failure of another field

2011-12-05 Thread Anthony
This is tricky. When the form is submitted, it doesn't send the location of the file on the user's computer -- it sends the actual file. Even if you knew the location of the file on the user's computer, you couldn't pre-populate the form field with that value because browsers won't allow it for

[web2py] Re: upload field in a generic form?

2011-10-25 Thread Anthony
On Monday, October 24, 2011 11:04:06 PM UTC-4, pepper_bg wrote: > > response.headers['Content-Type'] = > contenttype.contenttype(filename) Note, I believe response.stream will handle setting the Content-Type header for you.

[web2py] Re: upload field in a generic form?

2011-10-24 Thread pepper_bg
Great, response.stream did it! The exact code I end up using (in case someone else needs to get around the 'no_table.XXX' file name scenario). Another reason I like this approach (vs http://mysite.com/my_app/my_cont/download/uploads/no_table.document.9b6546236b10.623456345667.png) is the nonsensi

[web2py] Re: upload field in a generic form?

2011-10-24 Thread Anthony
response.download checks the db to get the uploadfolder from the upload field (which you don't have). Instead, you might be able to use response.stream directly: import os filename = [code to get filename from db] response.stream(os.path.join(request.folder, 'uploads', filename), request=reques

[web2py] Re: upload field change filename

2011-03-31 Thread Manuele Pesenti
Il 31/03/2011 12:46, Manuele Pesenti ha scritto: Hi *, is there a way to modify the file name with whom a file is stored in the filesystem using an upload field? I tryied in this way but without success: this answer to my quest thankyou anyway :) http://groups.google.com/group/web2py/browse_

Re: [web2py] Re: Upload field

2011-01-16 Thread Kenneth Lundström
Yes I was trying to understand how the manual uploading was working, never got it working, but I solved the issue an other way so did not put any more time on it. Kenneth Are you trying to do manual upload? I remember I got such an error a while back. Can't recall exactly what happened tha

[web2py] Re: Upload field

2011-01-15 Thread Arun K.Rajeevan
Are you trying to do manual upload? I remember I got such an error a while back. Can't recall exactly what happened that time. I'll let you know if I can recall. (My Hg repo., of that project is lost due to hdd malfunction :( )

[web2py] Re: Upload field

2011-01-15 Thread Massimo Di Pierro
Is there an oen issue here? I do no see a problem. On 11 tammi, 08:20, Richard Vézina wrote: > You need a upload field to store the path and a field to store the name of > the file... The book is not clear I think about upload particularly about > blob storage... > > My model : > > Field('chroma'

[web2py] Re: Upload Field in GAE

2010-06-08 Thread mdipierro
replace if form.accepts(request.vars, session): with if form.accepts(request.vars, session, dbio=False): the file will be in request.vars.logo.file On Jun 8, 8:02 am, arnaud wrote: > Hello, > > i work with Web2Py on GAE. I try to make a db.insert with > SQLFORM.factory method. > > def

[web2py] Re: upload field without storing the file

2010-02-11 Thread Iceberg
On Feb11, 9:11pm, Mike wrote: > Hopefully this is a quick one... > > I want to use SQLFORM to allow a user to save information about a file > including the *local path*. However I don't want to actually save the > file in the database. The idea is to parse the local path and save a > portion of it