uploading flat text to MySQL

From: Date: Sun, 22 Dec 2002 06:04:14 +0000
Subject: uploading flat text to MySQL
Groups: php.general 
Request: Send a blank email to php-general+get-129101@lists.php.net to get a copy of this message
I'm using a HTML form to submit flat text files to a MySQL database. When I upload the text file by FTP the script that loads it's contents into the database works as expected. When I upload using the HTML form it seems to ignore the new line in the text file. As a result it only creates one row in the table with some overflow in the last cell. Does anyone know how to deal with this? thanks, loop Relevant code (This executes without error)--- -- from .html ------ <form action="db_upload.php" method="post" ENCTYPE="multipart/form-data"> <input type="file" size=40 name="file"><br> <input type="hidden" name="MAX_FILE_SIZE" value="10000"> <input type="submit" value="upload"> </form> ---end from .html ---- --- from ,php ---- $file = $_FILES['file']['tmp_name']; $file_name = $_FILES['file']['name']; $path = "userfile/" . $file_name; $size = filesize($file); $type = $_FILES['file']['type']; if($type != 'text/plain') { echo "You may only upload text files."; exit; } if($size > 10000) { echo "The file is to large."; exit; } copy($file, "userfile/$file_name"); unlink($file); --- everything efter this working as expected ---- _________________________________________________________________ MSN 8 with e-mail virus protection service: 3 months FREE*. http://join.msn.com/?page=features/virus&xAPID=42&PS=47575&PI=7324&DI=7474&SU= http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_eliminateviruses_3mf

« previous php.general (#129101) next »