I was able to do it with the following code in the form validation hook.
I was able to do it with the following code in the form validation hook. Function mymodule_myform_validate($form, $form_state) { $validators = array('file_validate_extensions' => array('csv')); $file = file_save_upload('zipdata_file', $validators); ... }.
If you look at The forms API reference this comment explains how to do it. I can't exactly test it out, but possibly something like this $form'data_file' = array( '#type' => 'file', '#title' => t('Data File'), '#description' => t('CSV file to upload. '), '#upload_validators' => array( 'file_validate_extensions' => array(0 => 'csv'), 'file_validate_size' => array(32*1024*1024), ), ).
I don't see your file_validate_extensions implementation over there. – Coder1 Oct 5 '11 at 0:20 $form'file''#upload_validators''file_validate_extensions'0 = 'png jpg gif pdf'; It was just a few lines up the page. – DOKKA Oct 5 '11 at 0:51 You edited your post though.
You had array('0' => array('csv')). What you have now is exactly what my original version creates. – Coder1 Oct 5 '11 at 3:04 Now that I think about it, it would automatically go to index 0 of the array.So it would be the same thing you originally posted.
I just edited it again. If that doesn't work, I have no idea. – DOKKA Oct 5 '11 at 5:08.
Your form function // don't forget this line $form'#attributes' = array('enctype' => "multipart/form-data"); $form'container''csv_file' = array( '#type' => 'file' , '#title' => t('csv FILE') , '#description' => t('insert your csv file here') , ) ; Your validate function function _your_function_validate($form, $form_state) { $extensions = 'csv' ; $validators = array( 'file_validate_extensions' => array($extensions), ); // if the file not uploaded or the extension is wrong set error if(!file_save_upload('csv_file', $validators)) { // cvs_file is the form name form_set_error('csv_file', 'Please select the csv file') ; }else{ // now the form is uploaded lets make another validation for extension $file = file_save_upload('csv_file', $validators, file_directory_path()) ; // another validator for the extension if($file->filemime! = 'text/csv' ) { form_set_error('csv_file', 'Extensions Allowed : csv') ; } } }.
Note that in D7, you don't need the enctype attribute in the form. Drupal automatically adds it for you for file fields. – Coder1 Oct 11 '11 at 8:18 thanks for this info – maged adel Oct 11 '11 at 16:24.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.