Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7565719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:13:36+00:00 2026-05-30T14:13:36+00:00

Here recently I implemented a ReCAPTCHA script onto my upload script. What the problem

  • 0

Here recently I implemented a ReCAPTCHA script onto my upload script.

What the problem is, is that it waits until the WHOLE upload is done before it checks the ReCAPTCHA…

Can anyone tell me what i’m doing wrong?

<?php
include 'config.php';
$download = "caches/" . $_POST['email'] . ".zip";
$revision = $_POST['email'];
$details  = $_POST['password'];
$ip       = $_SERVER['REMOTE_ADDR'];
if ($revision >= 300 && $revision <= 499) {
    $table = "300caches";
} else if ($revision >= 500 && $revision <= 599) {
    $table = "500caches";
} else if ($revision >= 600 && $revision <= 800) {
    $table = "600caches";
} else {
    header('Location: error.php?err=rev');
}
require_once('captcha/recaptchalib.php');
$privatekey = "";
$resp       = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
    header('Location: error.php?err=rec');
}
if (!$_GET['act']) {
    if ((($_FILES["file"]["type"] == "application/zip") || ($_FILES["file"]["type"] == "application/octet-stream")) && ($_FILES["file"]["size"] < 315000000)) {
        if ($_FILES["file"]["error"] > 0) {
            header('Location: error.php?err=unknown');
        } else {
            if (file_exists("caches/" . $_FILES["file"]["name"])) {
                header('Location: error.php?err=fx&name=' . $_FILES["file"]["name"]);
            } else {
                $checkFile  = "main_file_cache.dat";
                $checkFile2 = "main_file_cache.dat0";
                $checkExe   = "exe";
                $zip        = new ZipArchive;
                $res        = $zip->open($_FILES["file"]["tmp_name"]);
                if (!is_numeric($zip->locateName($checkExe))) {
                    if ($res === TRUE) {
                        if (is_numeric($zip->locateName($checkFile)) || is_numeric($zip->locateName($checkFile2))) {
                            $uploaded = move_uploaded_file($_FILES["file"]["tmp_name"], "caches/" . $revision . ".zip");
                            if ($uploaded) {
                                $sql    = "INSERT INTO $table(revision, link, details, ip)VALUES('$revision', '$download', '$details', '$ip')";
                                $result = mysql_query($sql);
                                if ($result) {
                                    header("Location: index.php");
                                } else {
                                    header("Location: error.php?err=sql");
                                }
                            }
                            $zip->close();
                        } else {
                            header("Location: error.php?err=nc");
                        }
                    } else {
                        header("Location: error.php?err=nc");
                    }
                } else {
                    header("Location: error.php?err=nc");
                }
            }
        }
    } else {
        header('Location: error.php?err=if&name=' . $_FILES["file"]["name"]);
    }
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:13:37+00:00Added an answer on May 30, 2026 at 2:13 pm

    Of course it waits for the upload to finish.

    The data is sent to the server on the form submit, whether AJAX or not.
    The form data is not retrieved from the browser when you call the $_POST.

    A solution if your using ajax is too first check a different ajax page and check that the captcha was correct, and return a token which can be used in the file upload.

    Im not sure how you would get around this on just a normal file upload, other than having a page where a user enters a captcha before they can access the page for upload.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently implemented the ajax comet upload with progress found here: https://github.com/mbk/ajaxupload_with_comet When compiling
Here's a problem I ran into recently. I have attributes strings of the form
Here's an interesting problem. On a recently installed Server 2008 64bit I opened IE
I recently found a log statement in my projects codebase that says here i
I recently implemented pull to refresh here: https://github.com/leah/PullToRefresh . It kind of works however
Someone on here recently recommended BWToolkit, and it really impressed me, so I started
I asked a question [ here ] recently and it's just not providing me
I recently read a question on here about static and dynamic linking, which reminded
Recently I asked here how to add a new JPanel to JFrame . The
Here one more basic question asked in MS interview recently class A { public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.