Jump to content

[SOLVED] file_get_contents


graham23s

Recommended Posts

Hi Guys,

 

when using the get_file_contents function i allow users to upload doc and txt files, but i have noticed when PHP hits unusual character in the doc or txt files it, doesn't upload properly, is there a way i could strip all the extra characters and just have text from the file?

 

     $filename = $files;
     $content = file_get_contents("uploaded_files/$filename");     
     $files_for_mysql = mysql_real_escape_string($content);

 

thank guys

 

Graham

Link to comment
https://forums.phpfreaks.com/topic/53007-solved-file_get_contents/
Share on other sites

???

 

why do you need that just to allow users to upload a file?

 

if you are storing the file in a database then you store in a blob field - there are plenty of examples such as this http://www.phpbuilder.com/columns/florian19991014.php3 to do just that.

 

otherwise just upload the file to a directory.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.