I have a php file that takes an image from a website and stores it in my database. The name of the file contains an equals symbol. The file I end up storing is the image I get when I change the equals sign into ‘%3’ in the URL. How can I make it pick up the file that is in the location whose URL maintains the ‘=’?
$idNum=$_GET['idNum'];
$testpage = file_get_contents('http://www.something.com/php/thePic.php?id=$idNum');
$testpage = mysql_real_escape_string($testpage);
mysql_query("UPDATE tblSomething SET Pic = '$testpage' WHERE id='$idNum'");
Thanks,
R
The filename is coming out in a “urlencoded” form.. You need to use the urldecode() function to get back the = sign.
See more here – http://php.net/manual/en/function.urldecode.php
So before your SQL query, add this line-
urldecode($field);