--- C:\Documents and Settings\Aldo\Local Settings\Temp\TCVf191.tmp\field_image.1.20.inc	Sat Jul 01 00:13:13 2006
+++ D:\drupal cvs\contributions\modules\flexinode\field_image.inc	Sat Jul 01 00:10:14 2006
@@ -43,7 +43,9 @@
 
 function flexinode_field_image_insert($field, $node) {
   $fieldname = 'flexinode_'. $field->field_id;
-  $node->$fieldname = file_save_upload($node->$fieldname, $node->$fieldname->filename);
+  $savepath = flexinode_save_path((isset($field->options) ? $field->options[5]:NULL));
+
+  $node->$fieldname = file_save_upload($node->$fieldname, $savepath );
   $node->$fieldname->smallpath = flexinode_field_image_make_smaller($node->$fieldname->filepath, '_sm', $field->options[2]);
   $node->$fieldname->thumbpath = flexinode_field_image_make_smaller($node->$fieldname->filepath, '_th', $field->options[3]);
   $serialized = is_object($node->$fieldname) ? serialize($node->$fieldname) : '';
@@ -103,7 +105,8 @@
 
 function flexinode_field_image_execute($field, $node) {
   $fieldname = 'flexinode_'. $field->field_id;
-  if ($file = file_save_upload($fieldname, variable_get('file_directory_path', NULL))) {
+  $savepath = flexinode_save_path((isset($field->options) ? $field->options[5]:NULL));
+  if ($file = file_save_upload($fieldname, $savepath )) {
     return $file;
   }
   elseif(empty($node->$fieldname)) {
@@ -142,35 +145,41 @@
     );
   }
 
-  $form['tester'] = array(
+  $form['imageoptions'] = array(
     '#type' => 'fieldset',
     '#title' => t('Options'),
-    '#description' => t('Options for the image upload.'),
+    '#description' => t('Limitations and options for images to upload.'),
   );
-  $form['tester'][] = array('options][1' => array(
+  $form['imageoptions'][] = array('options][1' => array(
     '#type' => 'textfield',
     '#title' => t('Maximum picture dimensions'),
     '#default_value' => $field->options[1],
     '#description' => t('Maximum dimensions for pictures. Format: WidthxHeight'),
     ));
-  $form['tester'][] = array('options][2' => array(
+  $form['imageoptions'][] = array('options][2' => array(
     '#type' => 'textfield',
     '#title' => t('Preview dimensions'),
     '#default_value' => $field->options[2],
     '#description' => t('Dimensions for auto-created preview (scale will be preserved). Format: WidthxHeight'),
     ));
-  $form['tester'][] = array('options][3' => array(
+  $form['imageoptions'][] = array('options][3' => array(
     '#type' => 'textfield',
     '#title' => t('Thumbnail dimensions'),
     '#default_value' => $field->options[3],
     '#description' => t('Dimensions for auto-created thumbnail (scale will be preserved). Format: WidthxHeight'),
     ));
-  $form['tester'][] = array('options][4' => array(
+  $form['imageoptions'][] = array('options][4' => array(
     '#type' => 'textfield',
     '#title' => t('Maximum picture size'),
     '#default_value' => $field->options[4],
     '#description' => t('Maximum picture file size, in kB.'),
     ));
+  $form[] = array('options][5' => array(
+    '#type' => 'textfield',
+    '#title' => 'Save path format',
+    '#default_value' => $field->options[5],
+    '#description' => t('Enter save path format, this will be appended to file_directory_path, mark it up with %username, %day, %dayname, %month, %monthname, %year. Blank if not required. Example: nodefiles/%year/%month/%username. Directories will be created if not present, and original filenames are preserved.'),
+  ));
 
   return $form;
 }
