Avatar of peter-cooper
peter-cooper

asked on 

How do I Import CSV File In my PHP Application

Hello
I need to upload a csv file to php, parse the file and place the contents in a select element. I have tried various ways after searching google, but noting seems to work. This is new to me and would appreicate any help.

I have the html done but struggling to cope with php parsing of the file and populating select.

I would be grateful if someone could show me how to proceed with this as this would be my first time at handling this type of event. many thanks


<form enctype="multipart/form-data" action="somepage.php" method="post" id="upload"> 
        <table cellpadding="5" cellspacing="0" width="500" border="0"> 
            <tr> 
                <td class="width"><label for="image">Upload CSV file : </label></td> 
                <td><input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
                <input type="file" name="csvfile" id="csvfile" value=""/></td> 
                <td><input type="submit" name="uploadCSV" value="Upload" /></td> 
            </tr> 
        </table> 
    </form>

Open in new window

HTMLPHP

Avatar of undefined
Last Comment
Julian Hansen

8/22/2022 - Mon