diff --git a/features/file-upload.xml b/features/file-upload.xml
index 2909edcf1f..7815232d9e 100644
--- a/features/file-upload.xml
+++ b/features/file-upload.xml
@@ -80,10 +80,20 @@ Send this file: <INPUT NAME="userfile" TYPE="file">
Validating file uploads.
<?
-$validtmpdir = get_cfg_var("upload_tmp_dir");
-/* make sure you're using an uploaded file */
-if (strstr ("$validtmpdir", "$userfile") != 0){
- copy ("$userfile" "/place/to/put/uploaded/file");
+$validtmpdir = get_cfg_var("upload_tmp_dir");
+// get the path
+
+$uploaded_path_array = spilt("/","$userfile");
+//split the upload name into its components
+
+$inverted_path = array_reverse ($uploaded_path_array);
+// reverse the array, so any ending pathname will now be first
+
+$accurate_pathname = "$validtmpdir" . "$inverted_path[0]";
+
+if (file_exists($accurate_pathname )){
+//still look for proper temp name
+ copy ("$accurate_pathname", "/place/to/put/uploaded/file");
} else {
echo "Not an uploaded file!";
exit;