Package web2py :: Package gluon :: Module sqlhtml :: Class UploadWidget
[hide private]
[frames] | no frames]

Class UploadWidget

source code

object --+    
         |    
FormWidget --+
             |
            UploadWidget

Instance Methods [hide private]

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Static Methods [hide private]
 
widget(field, value, download_url=1, **attributes)
generates a INPUT file tag.
source code
 
represent(field, value, download_url=1)
how to represent the file:...
source code
 
is_image(value)
Tries to check if the filename provided references to an image Checking is based on filename extension.
source code

Inherited from FormWidget (private): _attributes

Class Variables [hide private]
  DEFAULT_WIDTH = '150px'
  ID_DELETE_SUFFIX = '__delete'
  GENERIC_DESCRIPTION = 'file'
  DELETE_FILE = 'delete'
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

widget(field, value, download_url=1, **attributes)
Static Method

source code 

generates a INPUT file tag.

Optionally provides an A link to the file, including a checkbox so the file can be deleted. All is wrapped in a DIV.

see also: :meth:`FormWidget.widget`

:param download_url: Optional URL to link to the file (default = None)
Overrides: FormWidget.widget

represent(field, value, download_url=1)
Static Method

source code 

how to represent the file:

- with download url and if it is an image: <A href=...><IMG ...></A>
- otherwise with download url: <A href=...>file</A>
- otherwise: file

:param field: the field
:param value: the field value
:param download_url: url for the file download (default = None)

is_image(value)
Static Method

source code 

Tries to check if the filename provided references to an image

Checking is based on filename extension. Currently recognized:
   gif, png, jp(e)g, bmp

:param value: filename