File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -4,3 +4,26 @@ django-validated-file
4
4
This Django app adds two field types, ValidatedFileField and ValidatedImageField, that add the
5
5
capability of checking the document size and types the user may send.
6
6
7
+ Installation
8
+ ------------
9
+
10
+ * Download and install package with python setup.py install.
11
+ * Note that this package depends on python-magic (to check field types).
12
+ * Add 'validatedfile' to your INSTALLED_APPS in settings.py.
13
+
14
+ Usage
15
+ -----
16
+
17
+ Create a model and add a field of type ValidatedFileField. You can add a maximum size in bytes
18
+ and a list of valid mime types that will be allowed. The list of all mime types is available
19
+ here: http://www.iana.org/assignments/media-types/index.html. If a user tries to upload a file
20
+ with too much size or without a valid type, a form validation error will occur::
21
+
22
+ class TestModel(models.Model):
23
+ the_file = ValidatedFileField(
24
+ null = True,
25
+ blank = True,
26
+ upload_to = 'testfile',
27
+ max_upload_size = 10240,
28
+ content_types = ['image/png'])
29
+
You can’t perform that action at this time.
0 commit comments