Quick fix for problem uploading images in phpAdsNew
I was installing a copy of phpAdsNew on a server and ran into a problem where the uploaded images were not saving to the specified local folder on the server.Â Searching for the answer was a nightmare, as the forums for the phpAdsNew is terrible.
Many of the threads I loaded included moderators yelling at the original posters that the issue was already addressed and told them to search harder.Â Granted I know how fustrating it is when you hear the same question again and again, I also believe there is no such thing as a bad question, now matter how many times it is asked by different people.Â My breaking point is when I hear the same question from the same individual multiple times.Â Â Anyway, I never found the actual solution to the problem but I gathered helpful hints which lead me to find a solution.
One of the posts suggested removing the @Â in front of all the functions and turning error reporting on for the web site.Â I did this and still received no error output.Â I was completely stumped.
Once I found that others were able to solve the problem by either reverting back to an older version of PHP or by installing on a different server with an older version of PHP, I decided to look specifically at how the uploads are being handled.Â I found the banner-edit.php script was using the $HTTP_POST_FILES PHP global variable.Â This global variable was changed in PHP version 4.0.3 to $_FILES.
To solve the problem, I added the following two lines of code near the top of the file.Â It does not have to be placed at the top of the script, but it needs to be inserted before the use of the $HTTP_POST_FILES array is used in the code.
if( isset($_FILES) && !isset($HTTP_POST_FILES) )
$HTTP_POST_FILES = $_FILES;
I am not exactly sure why they are using $HTTP_POST_FILES variable.Â I would presume if anyone was using that old of a version of PHP then they have other security issues to deal with and shouldn’t even allow file uploads. Hopefully the phpAdsNew folks will switch to the $_FILES array and soon before others get frustrated and end up using some other similar product.