Apostrophe Fix

PHP5.4-Myql 5+   –  APOSTROPHES, how to allow them in file names

Allow an apostrophe in a file name during the upload of a file.

This line is taking the data from within a page.  Meaning, I already passed the data, but before I insert it into MySql, I want to deal and allow the apostrohpe.

$file_name=mysqli_real_escape_string($mysqli,$file_name);

From a FORM Post we can also grab and deal with that apostrophe.

$file_name=mysqli_real_escape_string($mysqli,$_POST[‘file_name’]);

Insert into a mysql DB:

$mysql = INSERT into Table (file_name) VALUES (‘$file_name’);

 

In conclusion, we are using the mysqli real escape string to clean up the data from the user input.

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s