diff --git a/quizfileupload.classes.inc b/quizfileupload.classes.inc
index ed6fad1..f22f556 100755
--- a/quizfileupload.classes.inc
+++ b/quizfileupload.classes.inc
@@ -21,7 +21,7 @@
  */
 class QuizfileuploadQuestion extends QuizQuestion {
 
-   /**
+  /**
    * Implementation of save
    *
    * Stores the question in the database.
@@ -29,7 +29,8 @@ class QuizfileuploadQuestion extends QuizQuestion {
    * @param is_new if - if the node is a new node...
    * (non-PHPdoc)
    * @see sites/all/modules/quiz-HEAD/question_types/quiz_question/QuizQuestion#save()
-    */
+   */
+
   public function saveNodeProperties($is_new = FALSE) {
     $is_new = $is_new || $this->node->revision == 1;
     if ($is_new) {
@@ -38,17 +39,20 @@ class QuizfileuploadQuestion extends QuizQuestion {
           'nid' => $this->node->nid,
           'vid' => $this->node->vid,
           'filetypes' => $this->node->filetypes,
+          'type' => $this->node->quizfileupload_scoring[LANGUAGE_NONE][0]['value'],
         ))
         ->execute();
     }
     else {
       db_update('quiz_fileupload_node_properties')
-        ->fields(array('filetypes' => $this->node->filetypes))
+        ->fields(array(
+          'filetypes' => $this->node->filetypes,
+          'type' => $this->node->quizfileupload_scoring[LANGUAGE_NONE][0]['value']
+        ))
         ->condition('nid', $this->node->nid)
         ->condition('vid', $this->node->vid)
         ->execute();
     }
-
   }
 
   /**
@@ -101,8 +105,9 @@ class QuizfileuploadQuestion extends QuizQuestion {
     // Load the properties
     $res_a = db_query('SELECT filetypes FROM {quiz_fileupload_node_properties} WHERE nid = :nid AND vid = :vid',
       array(
-        ':nid' => $this->node->nid ,
-        ':vid' => $this->node->vid))->fetchAssoc();
+        ':nid' => $this->node->nid,
+        ':vid' => $this->node->vid
+      ))->fetchAssoc();
 
     if (is_array($res_a)) {
       $props = array_merge($props, $res_a);
@@ -133,11 +138,10 @@ class QuizfileuploadQuestion extends QuizQuestion {
    */
   public function getAnsweringForm(array $form_state = NULL, $rid) {
     $form = parent::getAnsweringForm($form_state, $rid);
-
     $fid = db_query('SELECT qf.fid
       FROM {quiz_fileupload_user_answers} qf
       WHERE question_nid = :nid AND question_vid = :vid AND result_id = :result_id',
-      array(':nid' => $this->node->nid, ':vid' => $this->node->vid,  ':result_id' => $rid))
+      array(':nid' => $this->node->nid, ':vid' => $this->node->vid, ':result_id' => $rid))
       ->fetchField();
 
     if (is_numeric($fid)) {
@@ -179,7 +183,7 @@ class QuizfileuploadQuestion extends QuizQuestion {
    * @see QuizQuestion#getMaximumScore()
    */
   public function getMaximumScore() {
-    return variable_get('quizfileupload_default_score', 1);
+    return variable_get('quizfileupload_default_score', 5);
   }
 
 }
@@ -192,36 +196,39 @@ class QuizfileuploadResponse extends QuizQuestionResponse {
    * ID of the answer.
    */
   protected $answer_id = 0;
+  protected $file=null;
 
   /**
    * Constructor
    */
   public function __construct($result_id, stdClass $question_node, $tries = NULL) {
     parent::__construct($result_id, $question_node, $tries);
-
     $tries = $_FILES;
     $this->answer = $tries;
     if (!isset($result) || !is_object($result)) {
       $result = new stdClass;
     }
     $result->is_correct = TRUE;
-    $this->question->score_weight = 0;
-    $this->evaluated = TRUE;
+    $this->evaluated = 0;
+    $response = $this->getResponse();
+    if (isset($question_node->quizfileupload_scoring[LANGUAGE_NONE][0]['value'])) {
+      if ($question_node->quizfileupload_scoring[LANGUAGE_NONE][0]['value'] == 0) {
+        $this->evaluated = 1;
+      }
+    }
     $this->result_id = $result_id;
-
     // Question has been answered allready. We fetch the answer data from the database.
     $r = db_query('SELECT * FROM {quiz_fileupload_user_answers}
     WHERE question_nid = :question_nid AND question_vid = :question_vid AND result_id = :result_id',
-    array(
-      ':question_nid' => $question_node->nid,
-      ':question_vid' => $question_node->vid,
-      ':result_id' => $result_id))->fetchAssoc();
+      array(
+        ':question_nid' => $question_node->nid,
+        ':question_vid' => $question_node->vid,
+        ':result_id' => $result_id
+      ))->fetchAssoc();
     if (is_array($r)) {
       $this->score = $r['score'];
       $this->answer_id = $r['answer_id'];
-    }
-    else {
-      $this->score = variable_get('quizfileupload_default_score', 1);
+      $this->evaluated = $r['is_evaluated'];
     }
   }
 
@@ -231,7 +238,12 @@ class QuizfileuploadResponse extends QuizQuestionResponse {
    * @see QuizQuestionResponse#isValid()
    */
   public function isValid() {
-    return TRUE;
+    if (isset($this->file->fid)) {
+      return TRUE;
+    }
+    else {
+      return "";
+    }
   }
 
   /**
@@ -240,18 +252,23 @@ class QuizfileuploadResponse extends QuizQuestionResponse {
    * @see QuizQuestionResponse#save()
    */
   public function save() {
-    $file = file_save_upload('tries', array(), 'public://');
-    //file_set_status($file, FILE_STATUS_PERMANENT);
-
-    $this->answer_id = db_insert('quiz_fileupload_user_answers')
-      ->fields(array(
-        'result_id' => $this->rid,
-        'question_vid' => $this->question->vid,
-        'question_nid' => $this->question->nid,
-        'fid' => $file->fid,
-        'score' => $this->score(),
-      ))
-      ->execute();
+    $validator = array(
+      'file_validate_extensions' => array($this->question->filetypes),
+    );
+    $this->file = file_save_upload('tries', $validator, 'public://');
+    if (isset($this->file->fid)) {
+      dpm($this->file, "File inside save");
+      $this->answer_id = db_insert('quiz_fileupload_user_answers')
+        ->fields(array(
+          'result_id' => $this->rid,
+          'question_vid' => $this->question->vid,
+          'question_nid' => $this->question->nid,
+          'fid' => $this->file->fid,
+          'score' => $this->getScore(FALSE),
+          'is_evaluated' => $this->evaluated,
+        ))
+        ->execute();
+    }
   }
 
   /**
@@ -275,7 +292,20 @@ class QuizfileuploadResponse extends QuizQuestionResponse {
    * @see QuizQuestionResponse#score()
    */
   public function score() {
-    return variable_get('quizfileupload_default_score', 0);
+    if ($this->question->quizfileupload_scoring[LANGUAGE_NONE][0]['value'] == 1) {
+      $score = db_query('SELECT score FROM {quiz_fileupload_user_answers} WHERE result_id = :result_id AND question_vid = :question_vid', array(
+        ':result_id' => $this->rid,
+        ':question_vid' => $this->question->vid
+      ))->fetchField();
+      if (!$score) {
+        $score = 0;
+      }
+    }
+    else {
+      $shortAnswer = new QuizfileuploadQuestion($this->question);
+      $score = $shortAnswer->getMaximumScore();
+    }
+    return $score;
   }
 
   /**
@@ -303,16 +333,82 @@ class QuizfileuploadResponse extends QuizQuestionResponse {
       array(
         ':result_id' => $result_id,
         ':question_nid' => $this->question->nid,
-        ':question_vid' => $this->question->vid))
-        ->fetchField();
-
+        ':question_vid' => $this->question->vid
+      ))
+      ->fetchField();
     $markup = quiz_file_markup($fid);
-
+    if ($this->question && !empty($this->question->answers)) {
+      $answer = (object) current($this->question->answers);
+    }
+    if ($answer->is_evaluated == 1) {
+      // Show feedback, if any.
+      if ($showfeedback && !empty($answer->feedback)) { // @todo: Feedback doesn't seem to be in use anymore...
+        $feedback = check_markup($answer->feedback);
+      }
+    }
+    else {
+      $feedback = t('This answer has not yet been scored.') .
+        '<br/>' .
+        t('Until the answer is scored, the total score will not be correct.');
+      //dpm("Has not been evaluated");
+    }
     return array(
       '#type' => 'markup',
       '#markup' => $markup
     );
   }
+
+
+  public function getReportFormScore($showfeedback = TRUE, $showpoints = TRUE, $allow_scoring = FALSE) {
+    dpm($this->question, "this question");
+    $node = node_load($this->question->nid);
+    $score = ($this->isEvaluated()) ? $this->getScore() : '?';
+    dpm($node->quizfileupload_scoring[LANGUAGE_NONE][0]['value'], "node value");
+    if (quiz_access_to_score() && $allow_scoring && ($node->quizfileupload_scoring[LANGUAGE_NONE][0]['value'] == 1)) {
+      return array(
+        '#type' => 'textfield',
+        '#default_value' => $score,
+        '#size' => 3,
+        '#maxlength' => 3,
+        '#attributes' => array('class' => array('quiz-report-score')),
+      );
+    }
+    else {
+      return array(
+        '#markup' => $score,
+      );
+    }
+  }
+
+  /**
+   * Implementation of getReportFormSubmit
+   *
+   * @see QuizQuestionResponse#getReportFormSubmit($showfeedback, $showpoints, $allow_scoring)
+   */
+  public function getReportFormSubmit($showfeedback = TRUE, $showpoints = TRUE, $allow_scoring = FALSE) {
+    $node = node_load($this->question->nid);
+    if (isset($node->quizfileupload_scoring[LANGUAGE_NONE][0]['value'])) {
+      if (quiz_access_to_score() && $allow_scoring && ($node->quizfileupload_scoring[LANGUAGE_NONE][0]['value'] == 1)) {
+        return $allow_scoring ? 'quizfileupload_report_submit' : FALSE;
+      }
+    }
+    return FALSE;
+  }
+
+  /**
+   * Implementation of getReportFormValidate
+   *
+   * @see QuizQuestionResponse#getReportFormValidate($showfeedback, $showpoints, $allow_scoring)
+   */
+  public function getReportFormValidate($showfeedback = TRUE, $showpoints = TRUE, $allow_scoring = FALSE) {
+    $node = node_load($this->question->nid);
+    if (isset($node->quizfileupload_scoring[LANGUAGE_NONE][0]['value'])) {
+      if (quiz_access_to_score() && $allow_scoring && ($node->quizfileupload_scoring[LANGUAGE_NONE][0]['value'] == 1)) {
+        return $allow_scoring ? 'quizfileupload_report_validate' : FALSE;
+      }
+    }
+    return FALSE;
+  }
 }
 
 function quiz_file_markup($fid) {
@@ -324,7 +420,7 @@ function quiz_file_markup($fid) {
 
     // not image
     if (count($errors)) {
-      return l($file->filename , file_create_url($file->uri));
+      return l($file->filename, file_create_url($file->uri));
     }
     // image, we use thumbnail
     else {
@@ -347,4 +443,4 @@ function quiz_file_markup($fid) {
   else {
     return t('n/a');
   }
-}
+}
\ No newline at end of file
diff --git a/quizfileupload.info b/quizfileupload.info
index 099e0f0..d3bd0b2 100644
--- a/quizfileupload.info
+++ b/quizfileupload.info
@@ -4,4 +4,10 @@ description = Fileupload question type for quiz.
 core = 7.x
 dependencies[] = quiz
 dependencies[] = quiz_question
-files[] = quizfileupload.classes.inc
\ No newline at end of file
+files[] = quizfileupload.classes.inc
+; Information added by drupal.org packaging script on 2013-07-10
+version = "7.x-1.0"
+core = "7.x"
+project = "quizfileupload"
+datestamp = "1373451353"
+
diff --git a/quizfileupload.install b/quizfileupload.install
index be72fc2..ac3ab3a 100644
--- a/quizfileupload.install
+++ b/quizfileupload.install
@@ -17,6 +17,107 @@ function quizfileupload_install() {
 
   cache_clear_all('autoload:', 'cache');
   variable_set('node_options_quizfileupload', array('status'));
+
+  $field = field_info_field('quizfileupload_scoring');
+  if (empty($field)) {
+  field_create_field(array(
+    'translatable' => '0',
+    'entity_types' => array(),
+    'settings' => array(
+      'allowed_values' => array(
+        '0' => 'None',
+        '1' => 'Manual',
+      ),
+      'allowed_values_function' => '',
+    ),
+    'storage' => array(
+      'type' => 'field_sql_storage',
+      'settings' => array(),
+      'module' => 'field_sql_storage',
+      'active' => '1',
+      'details' => array(
+        'sql' => array(
+          'FIELD_LOAD_CURRENT' => array(
+            'field_data_field_scoring' => array(
+              'value' => 'field_scoring_value',
+            ),
+          ),
+          'FIELD_LOAD_REVISION' => array(
+            'field_revision_field_scoring' => array(
+              'value' => 'field_scoring_value',
+            ),
+          ),
+        ),
+      ),
+    ),
+    'foreign keys' => array(),
+    'indexes' => array(
+      'value' => array(
+        'value',
+      ),
+    ),
+    'field_name' => 'quizfileupload_scoring',
+    'type' => 'list_text',
+    'module' => 'list',
+    'active' => '1',
+    'locked' => '0',
+    'cardinality' => '1',
+    'deleted' => '0',
+    'columns' => array(
+      'value' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => FALSE,
+      ),
+    ),
+    'bundles' => array(
+      'node' => array(
+        'quizfileupload',
+      ),
+    ),
+  ));}
+
+    $instance = field_info_instance('node', 'quizfileupload_scoring', 'quizfileupload');
+    if (empty($instance)) {
+  field_create_instance(array(
+    'label' => 'Scoring',
+    'widget' => array(
+      'weight' => '-2',
+      'type' => 'options_buttons',
+      'module' => 'options',
+      'active' => 1,
+      'settings' => array(),
+    ),
+    'settings' => array(
+      'user_register_form' => FALSE,
+    ),
+    'display' => array(
+      'default' => array(
+        'label' => 'above',
+        'type' => 'list_default',
+        'settings' => array(),
+        'module' => 'list',
+        'weight' => 1,
+      ),
+      'teaser' => array(
+        'type' => 'hidden',
+        'label' => 'above',
+        'settings' => array(),
+        'weight' => 0,
+      ),
+    ),
+    'required' => 1,
+    'description' => '',
+    'default_value' => array(
+      array(
+        'value' => 'None',
+      ),
+    ),
+    'field_name' => 'quizfileupload_scoring',
+    'entity_type' => 'node',
+    'bundle' => 'quizfileupload',
+    'deleted' => '0',
+  ));}
 }
 
 /**
@@ -31,6 +132,12 @@ function quizfileupload_schema() {
         'unsigned' => TRUE,
         'not null' => TRUE,
       ),
+      'is_evaluated' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
       'result_id' => array(
         'type' => 'int',
         'unsigned' => TRUE,
@@ -80,6 +187,11 @@ function quizfileupload_schema() {
       'filetypes' => array(
         'type' => 'text',
       ),
+      'type' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ),
     ),
     'primary key' => array(
       'nid', 'vid'
diff --git a/quizfileupload.module b/quizfileupload.module
index b4d9883..77d7b33 100644
--- a/quizfileupload.module
+++ b/quizfileupload.module
@@ -12,7 +12,7 @@
 
 /**
  * define default allowed extensions
- */ 
+ */
 define('QUIZFILEUPLOAD_DEFAULT_EXTENSIONS', 'png pdf odf doc docx');
 
 /**
@@ -45,7 +45,7 @@ function quizfileupload_config() {
     '#title' => t('Default score'),
     '#required' => TRUE,
     '#default_value' => variable_get('quizfileupload_default_score', 1),
-  );  
+  );
   $form['quizfileupload_default_extensions'] = array(
     '#type' => 'textarea',
     '#title' => t('Allowed extension'),
@@ -56,16 +56,91 @@ function quizfileupload_config() {
   return $form;
 }
 
-
 /**
  * Fork of file_validate_extensions().
- */ 
+ */
 function quizfileupload_validate_extensions($file, $extensions) {
   $errors = array();
-
   $regex = '/\.(' . preg_replace('/ +/', '|', preg_quote($extensions)) . ')$/i';
   if (!preg_match($regex, $file->filename)) {
     $errors[] = t('Only files with the following extensions are allowed: %files-allowed.', array('%files-allowed' => $extensions));
   }
   return $errors;
 }
+
+/**
+ * Validate the result report for short answer
+ */
+function quizfileupload_report_validate($values, $form_key) {
+  // Check to make sure that entered score is not higher than max allowed score.
+  if (!_quiz_is_int($values['score'], 0, (int) $values['max_score'])) {
+    form_set_error($form_key . '][score', t('The score needs to be a number between 0 and @max', array('@max' => (int) $values['max_score'])));
+  }
+}
+
+/**
+ * Submit the result report for short answer
+ */
+function quizfileupload_report_submit($values) {
+  dpm("Coming inside report submit");
+  quizfileupload_score_an_answer($values, FALSE);
+}
+
+function quizfileupload_score_an_answer($values, $update_total = TRUE) {
+  dpm("Here we are, Updating the question score");
+  extract($values);
+  dpm($score, "The score wanted is");
+  dpm($nid, "node if");
+  // When we set the score we make sure that the max score in the quiz the question belongs to is considered
+  $question_max_score = db_query('SELECT max_score FROM {quiz_question_properties} WHERE nid = :nid AND vid = :vid', array(
+    ':nid' => $nid,
+    ':vid' => $vid
+  ))->FetchField();
+  dpm($quiz->vid, "quiz vid");
+  dpm($vid, "vid");
+  $quiz_max_score = db_query('SELECT max_score FROM {quiz_node_relationship} WHERE parent_vid = :pvid AND child_vid = :cvid', array(
+    ':pvid' => $quiz->vid,
+    ':cvid' => $vid
+  ))->fetchField();
+  dpm($question_max_score, "question max score");
+  dpm($quiz_max_score, "quiz max score");
+  $changed = db_update('quiz_fileupload_user_answers')
+    ->fields(array(
+      'score' => $score * $question_max_score / $quiz_max_score,
+      'is_evaluated' => 1,
+    ))
+    ->condition('question_nid', $nid)
+    ->condition('question_vid', $vid)
+    ->condition('result_id', $rid)
+    ->execute();
+  dpm($score, "score calculated");
+  // Now the short answer user data has been updated. We also need to update the data in the quiz tables
+  if ($changed > 0) {
+    $max = db_query('SELECT max_score FROM {quiz_question_properties} WHERE vid = :vid', array(':vid' => $vid))->fetchField();
+    if ($max <= 0) {
+      $is_correct = 0;
+      $points_awarded = 0;
+    }
+    else {
+      $is_correct = ($score / $max > 0.5) ? 1 : 0;
+      $points_awarded = $score;
+    }
+
+    db_update('quiz_node_results_answers')
+      ->fields(array(
+        'points_awarded' => $points_awarded,
+        'is_correct' => $is_correct,
+      ))
+      ->condition('question_vid', $vid)
+      ->condition('result_id', $rid)
+      ->execute();
+
+    // Third, we update the main quiz results table
+    if ($update_total) {
+      quiz_update_total_score($quiz, $rid);
+    }
+  }
+  return $changed;
+}
+
+
