45 if( defined(
'NO_DIRECT_CALL' ) ===
false )
52 if (isset($_POST[
"PHPSESSID"])) {
53 session_id($_POST[
"PHPSESSID"]);
54 }
else if (isset($_GET[
"PHPSESSID"])) {
55 session_id($_GET[
"PHPSESSID"]);
66 header(
"HTTP/1.1 500 Internal Server Error");
67 echo
"POST exceeded maximum allowed size.";
76 # added $extension_whitelist = array("jpg", "gif", "png"); // Allowed file extensions
87 0=>
"There is no error, the file uploaded with success",
88 1=>
"The uploaded file exceeds the upload_max_filesize directive in php.ini",
89 2=>
"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form",
90 3=>
"The uploaded file was only partially uploaded",
91 4=>
"No file was uploaded",
92 6=>
"Missing a temporary folder"
97 HandleError(
"No upload found in \$_FILES for " . $upload_name);
99 }
else if (isset($_FILES[$upload_name][
"error"]) && $_FILES[$upload_name][
"error"] != 0) {
102 }
else if (!isset($_FILES[$upload_name][
"tmp_name"]) || !@is_uploaded_file($_FILES[$upload_name][
"tmp_name"])) {
103 HandleError(
"Upload failed is_uploaded_file test.");
105 }
else if (!isset($_FILES[$upload_name][
'name'])) {
113 HandleError(
"File exceeds the maximum allowed size");
118 HandleError(
"File size outside allowed lower bound");
124 #$file_name = preg_replace('/[^'.$valid_chars_regex.']|\.+$/i', "", basename($_FILES[$upload_name]['name']));
125 $file_name = basename($_FILES[$upload_name][
'name']);
131 $file_name = md5( $file_name.microtime(
true ) );
142 #if (file_exists($save_path . $file_name)) {
143 # HandleError("File with this name already exists");
152 foreach ($extension_whitelist as $extension) {
154 if( $extension ==
'*' ){
189 if (!@move_uploaded_file($_FILES[$upload_name][
"tmp_name"], $save_path.$file_name)) {