csv header -mapping

Hi all,

I need to append the headers to specific attributes within a form from
an imported csv file, for example; I have a model which contain only
":name" field but csv file contain firstname and last name (csv files
are submitted by user ,so there is no control over file format ) CSV
file may look like
          FirstName,Lastname
          smith,paul
how can i drag the fields from the csv file into the correct column for
(:name as example you could drag the fields of firstname and lastname
and append them both to name),how user can select each header from a
column and attach the header to the form field.. is there any javascript
to do this.. if so can anyone share some links to get an idea

Thank u