Hi everyone,
I got trouble uploading a csv file in php. Cant seem to figure out whats wrong, it always lead me to "nicetry" even though im sure im uploading a csv file.
upload_page
<?php echo "<form action='upload_process.php' id='upload_form' method='post' enctype='multipart/form-data'>"; echo "<table id='class1' align='center'>"; echo "<tr>"; echo "<th colspan=2>Upload</th>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=2><input type='file' name='file' id='file' size='50'/></td>"; echo "</tr>"; echo "<tr class='alt'>"; echo "<td colspan=2><input type='submit' name='upload' value='upload' /></td>"; echo "</tr>"; echo "</table>"; echo "</form>"; ?>
upload_process
$mimes = array('application/vnd.ms-excel','text/plain','text/csv','text/tsv'); if(in_array($_FILES['file']['type'],$mimes)){ echo "csv file!"; } else { echo "nicetry"; }
any input would be very much appreciated.
thanks!