Index: main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/filedisplay.pt
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/filedisplay.pt	(revision 7105)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/filedisplay.pt	(revision 7106)
@@ -7,6 +7,6 @@
   <td class="field">
     <span class="widget">
-      <a tal:attributes="href viewlet/img_src"
-         tal:content="viewlet/img_src"
+      <a tal:attributes="href viewlet/download_name"
+         tal:content="viewlet/download_name"
          target="image">
         LINK
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/fileupload.pt
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/fileupload.pt	(revision 7105)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/fileupload.pt	(revision 7106)
@@ -7,6 +7,6 @@
   <td class="field">
     <span class="widget">
-      <a tal:attributes="href viewlet/img_src"
-         tal:content="viewlet/img_src"
+      <a tal:attributes="href viewlet/download_name"
+         tal:content="viewlet/download_name"
          target="image">
         LINK
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/imagedisplay.pt
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/imagedisplay.pt	(revision 7105)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/imagedisplay.pt	(revision 7106)
@@ -7,5 +7,5 @@
   <td class="field">
     <span class="widget">
-      <img tal:attributes="src viewlet/img_src" /><br />
+      <img tal:attributes="src viewlet/download_name" /><br />
     </span>
   </td>
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/imageupload.pt
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/imageupload.pt	(revision 7105)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/imageupload.pt	(revision 7106)
@@ -7,5 +7,5 @@
   <td class="field">
     <span class="widget">
-      <img tal:attributes="src viewlet/img_src" /><br />
+      <img tal:attributes="src viewlet/download_name" /><br />
       <input type="file" tal:attributes="name viewlet/input_name"/>
       <br />
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/student.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/student.py	(revision 7105)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/student.py	(revision 7106)
@@ -177,5 +177,5 @@
         return name == self.chooseName()
 
-    def chooseName(self, name=None, attr=None):
+    def chooseName(self, attr, name=None):
         """Get a valid file id for student context.
 
@@ -183,18 +183,19 @@
 
         For a student with student id ``'A123456'`` and
-        with attr ``'nice_image'`` stored in
+        with attr ``'nice_image.jpeg'`` stored in
         the students container this chooser would create:
 
-          ``'__file-student__students/A/A123456/nice_image_A123456.jpg'``
+          ``'__file-student__students/A/A123456/nice_image_A123456.jpeg'``
 
         meaning that the nice image of this applicant would be
         stored in the site-wide file storage in path:
 
-          ``students/A/A123456/nice_image_A123456.jpg``
-
-        """
+          ``students/A/A123456/nice_image_A123456.jpeg``
+
+        """
+        basename, ext = os.path.splitext(attr)
         stud_id = self.context.student_id
-        marked_filename = '__%s__%s/%s/%s_%s.jpg' % (
-            STUDENT_FILE_STORE_NAME, stud_id[0], stud_id, attr, stud_id)
+        marked_filename = '__%s__%s/%s/%s_%s%s' % (
+            STUDENT_FILE_STORE_NAME, stud_id[0], stud_id, basename, stud_id, ext)
         return marked_filename
 
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py	(revision 7105)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py	(revision 7106)
@@ -393,5 +393,5 @@
         self.browser.getControl("Save").click() # submit form
         self.assertTrue(
-            'Uploaded image is too big' in self.browser.contents)
+            'Uploaded file is too big' in self.browser.contents)
 
     def test_manage_course_lists(self):
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/viewlets.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/viewlets.py	(revision 7105)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/viewlets.py	(revision 7106)
@@ -1,2 +1,3 @@
+import os
 import grok
 from zope.component import getUtility
@@ -198,6 +199,6 @@
         return self.view.application_url() + rel_link
 
-def handle_img_upload(upload, context, view, max_size, attr=None):
-    """Handle upload of applicant image.
+def handle_file_upload(upload, context, view, max_size, download_name=None):
+    """Handle upload of student file.
 
     Returns `True` in case of success or `False`.
@@ -206,11 +207,24 @@
     points to end of file when leaving this function.
     """
+    # Check some file requirements first
+    if upload.filename.count('.') == 0:
+        view.flash('File name has no extension.')
+        return False
+    if upload.filename.count('.') > 1:
+        view.flash('File name contains more than one dot.')
+        return False
+    basename, expected_ext = os.path.splitext(download_name)
+    dummy, ext = os.path.splitext(upload.filename)
+    ext.lower()
+    if ext != expected_ext:
+        view.flash('%s extension expected.' % expected_ext)
+        return False
     size = file_size(upload)
     if size > max_size:
-        view.flash('Uploaded image is too big!')
+        view.flash('Uploaded file is too big.')
         return False
     upload.seek(0) # file pointer moved when determining size
     store = getUtility(IExtFileStore)
-    file_id = IFileStoreNameChooser(context).chooseName(attr=attr)
+    file_id = IFileStoreNameChooser(context).chooseName(attr=download_name)
     store.createFile(file_id, upload)
     return True
@@ -231,7 +245,6 @@
     grok.order(1)
     grok.require('waeup.viewStudent')
-    label = u'Some Text:'
-    img_src = u'filename.jpg'
-    attr = None
+    label = u'File:'
+    download_name = u'filename.jpg'
 
 class FileUpload(FileDisplay):
@@ -252,11 +265,12 @@
         if upload:
             # We got a fresh upload
-            file_changed = handle_img_upload(
-                upload, self.context, self.view, self.mus, self.attr)
+            file_changed = handle_file_upload(
+                upload, self.context, self.view, self.mus, self.download_name)
             if file_changed is False:  # False is not None!
-                self.view.redirect(self.view.url(self.context))
-                return # error during image upload. Ignore other values
+                self.view.redirect(
+                    self.view.url(self.context, self.view.__name__))
+                return # error during file upload. Ignore other values
             else:
-                self.view.files_changed += self.img_src
+                self.view.files_changed += self.download_name
         return
 
@@ -266,6 +280,5 @@
     grok.order(1)
     label = u'Birth Certificate:'
-    img_src = u'birth_certificate.jpg'
-    attr = u'birth_certificate'
+    download_name = u'birth_certificate.jpg'
 
 class BirthCertificateUpload(FileUpload):
@@ -273,18 +286,17 @@
     """
     grok.order(1)
-    label = u'Birth Certificate:'
+    label = u'Birth Certificate (jpeg image):'
     mus = 1024 * 150
-    img_src = u'birth_certificate.jpg'
+    download_name = u'birth_certificate.jpg'
     input_name = u'form.birth_certificate'
-    attr = u'birth_certificate'
 
 class Image(grok.View):
-    """Renders image for students.
-    """
+    """Renders jpeg images for students.
+    """
+    grok.baseclass()
     grok.name('none.jpg')
     grok.view(StudentClearanceManageFormPage)
     grok.require('waeup.viewStudent')
-    grok.baseclass()
-    attr = None
+    download_name = u'none.jpg'
 
     def render(self):
@@ -292,5 +304,6 @@
         # for file storage.
         image = getUtility(IExtFileStore).getFileByContext(
-            self.context, attr=self.attr)
+            self.context, attr=self.download_name)
+        # We expect that image is a jpeg pictures
         self.response.setHeader(
             'Content-Type', 'image/jpeg')
@@ -301,6 +314,6 @@
 
 class BirthCertificateImage(Image):
-    """Renders birth certificate.
+    """Renders birth certificate jpeg image.
     """
     grok.name('birth_certificate.jpg')
-    attr = u'birth_certificate'
+    download_name = u'birth_certificate.jpg'
