6291456) {
    echo "Sorry, your file is too large. (Max is 6MB)";
    $uploadOk = 0;
    header('Location: ./uploadfailedr2.php');
}
/*
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" && $imageFileType != "svg" ) {
    echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
    $uploadOk = 0;
    header('Location: ./uploadfailed.php');
}
*/
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
    echo "Sorry, your file could not be uploaded.";
    header('Location: ./uploadfailedr2.php');
// if everything is ok, try to upload file
} else if ($uploadOk == 1) {
    $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_';
    $random_string_length = 12;
    $randomFilename = '';
    for ($i = 0; $i < $random_string_length; $i++) {
      $randomFilename .= $characters[rand(0, strlen($characters) - 1)];
    }
    //$newfilename = time() . '_' . rand(1000000, 9999999) . '.' . end(explode(".",$_FILES["fileToUpload"]["name"])); --prior to v0.6b
    //$newfilename = time() . '_' . rand(100, 999) . '_' . rand(100000000, 999999999) . '.' . end(explode(".",$_FILES["fileToUpload"]["name"])); --prior to v0.8
    $newfilename = $randomFilename . '.' . end(explode(".",$_FILES["fileToUpload"]["name"]));
    $newtarget = $target_dir . $newfilename;
    //if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $newtarget)) {
        chmod("$newtarget", 0775); // Set read and write permissions if file
        //echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
        //header('Location: http://zxicar.us/imeji/private/' . $newfilename);
        //echo "The file \"" . basename( $_FILES["fileToUpload"]["name"]) . "\" has been uploaded to 
 http://zxicar.us/imeji/private/" . $newfilename;
        $xmessage1 = 'The file "' . basename( $_FILES["fileToUpload"]["name"]) . '" has been uploaded to the following link: (you might wanna copy it)';
        $xmessage2 = 'https://zxicar.us/imeji/private/' . $newfilename;
        echo $xmessage1 . "
";
        echo "".$xmessage2."";
		//echo "";
        //header('Location: ../imeji/' . $newtarget); --changed as of v0.7
        //header('Location: http://zxicar.us/imeji/'.basename( $_FILES["fileToUpload"]["name"])); --changed as of v0.2
    } else {
        echo "Sorry, there was a problem uploading your file.";
        header('Location: ./uploadfailedr2.php');
    }
} else if ($uploadOk == 2) {
    echo "Authentication code is invalid.";
    header('Location: ./uploadfailedr1.php');
}
?>