I have this file that I am uploading to the server via php file upload..
6;'!8.jpg
I used this code to remove non alphanumeric characters..
$image1 = ereg_replace("[^A-Za-z0-9]", "", $_FILES["image"]["name"]);
that works fine, but it returns my image like this
68jpg
What would be the best way to return this as 68.jpg
Any ideas?
Don't use ereg/eregi. These functions are deprecated. Use PCRE functions instead.
Try this way
$image1 = preg_replace("#[^a-z0-9\.]#i", null, $_FILES["image"]["name"]);