Hi, I have two php pages that upload files to a mysql db. I do not know how to change this code to accept more than plain text files. Specifically, I would like to accept .doc and .xls files. Can anyone help? Thanks...Will
This is my upload form.... <body> <h3> Upload a New File</h3> <form enctype="multipart/form-data" action="item_upload.php" method=post> <input type="hidden" name="MAX_FILE_SIZE" value="100000"> Upload this file: <input name="userfile" type="file"> <input type="submit" value="Send File"> </form> </body> </html> This, I use to handle the uploaded file... <? if ($userfile=="none") { echo "Problem: no file uploaded"; exit; } if ($userfile_size==0) { echo "Problem: uploaded file is zero length"; exit; } if (!is_uploaded_file($userfile)) { echo "Problem: possibles file upload attack"; exit; } $upfile = "../uploads/".$userfile_name; if ( !copy($userfile, $upfile)) { echo "Problem: Could not move file into directory"; exit; } echo "File uploaded successfully<br><br>"; $fp = fopen($upfile, "r"); $contents = fread ($fp, filesize ($upfile)); fclose ($fp); $contents = strip_tags($contents); $fp = fopen($upfile, "w"); fwrite($fp, $contents); fclose($fp); echo "preview of uploaded file contents:<br><hr>"; echo $contents; echo "<br><hr>"; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php