how to read csv file in drupal 6 I want to read a simple csv file having 6 rows and 2 columns :

   **name   |  value**
    AJW097  |   1
    BDV763  |   1
    PVWC67  |   1
    WPC028  |   1
    TGI0227 |   1
    W5615C  |   1


I had saved this file here sites/default/files/csvfile.csv

here is the code i am using:

function my_module_form($form, &amp;$form_state) {
$form = array();
  $form['browser'] = array(
    '#type' =&gt; 'fieldset',
    '#title' =&gt; t('Browser Upload'),
    '#collapsible' =&gt; TRUE,
    '#description' =&gt; t("Upload a CSV file."),
  );
  $file_size = t('Maximum file size: !size MB.', array('!size' =&gt; file_upload_max_size()));
  $form['browser']['upload_file'] = array(
    '#type' =&gt; 'file',
    '#title' =&gt; t('CSV File'),
    '#size' =&gt; 40,
    '#description' =&gt; t('Select the CSV file to be upload. ') . $file_size,
  );

  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Upload CSV File'),
  );

  $form['#attributes']['enctype'] = "multipart/form-data";
  return $form;
}



function my_module_form_submit($form, &amp;$form_state) {
  $filepath = $form_state['values']['upload_file']-&gt;filepath;
  $fp = fopen($filepath,'r') or die("can't open file");


print "&lt;table&gt;\n";

while($csv_line = fgetcsv($fp,1024)) {
    print '&lt;tr&gt;';
    for ($i = 0, $j = count($csv_line); $i &lt; $j; $i++) {
        print '&lt;td&gt;'.$csv_line[$i].'&lt;/td&gt;';
    }
    print "&lt;/tr&gt;\n";
}
print '&lt;/table&gt;';
fclose($fp) or die("can't close file");
}


The problem is it is not reading the file and every time i click on Upload CSV File button it dies and say: can't open file.
where i am doing wrong?
try function form submit like:

function my_module_form_submit($form, &amp;$form_state) {
  $line_max = variable_get('user_import_line_max', 1000);
  ini_set('auto_detect_line_endings', true);
  $filepath = $form_state['values']['file_upload']-&gt;filepath;
  $handle = @fopen($filepath, "r");
  // start count of imports for this upload
  $send_counter = 0;
  while ($row = fgetcsv($handle, $line_max, ',')) {
    // $row is an array of elements in each row
    // e.g. if the first column is the email address of the user, try something like
    $mail = $row[0];
  }
}