Motion detection + HTTP Post on webcamxp not uploading


#1

I have motion detection setup to “run HTTP Post”. Motion triggers log entries, but it won’t upload the files.

I have auto upload HTTP post working perfectly. If I set it to every 10 seconds or so, the log shows the following, and my webserver receives the file just fine.

HTTP Post Thread Started
Add File : cam_2.jpg
HTTP Post Success : HTTP/1.1 200 OK

With auto-upload disabled, motion detection and run HTTP post enabled, if I move in front of the webcam, it triggers these log entries:

HTTP Post Thread Started
HTTP Post : No file to process.

When there is no motion, there are no log entries.

If I click the “upload” button to manually upload a snapshot, or I set the auto-upload to upload every 10 seconds, those files get automatically uploaded, even while the simultaneous motion detection triggered events fail.

I see no settings to configure how the motion module talks to the HTTP post module. I have moved my camera to slot 1, with the same results. How can I fix this?

Thanks,
Cory


#2

webcamXP Free v5.9.2.0 Build 39500, Windows 7/64, Logitech 615.

Btw, here is my php script for posterity since I could not find an example on this website.
This outputs debug notes to a log file and to the web browser. It also saves previous images.

<?php
function tee ($fileh, $data) {
   echo $data;
   fwrite($fileh, $data);
}

$logh = fopen("upload.log",'w');
$uploaddir = realpath('./') . '/';
$uploadfile = $uploaddir . basename($_FILES['FILE1']['name']);
$uploadtmp = $uploadfile."-tmp";
$timestamp = date("Y-m-d-H-i-s");

echo '< pre>;'; //REMOVE SPACE BEFORE pre
    tee($logh, "Log time   : $timestamp\n");
    tee($logh, "Upload dir : $uploaddir\n");
    tee($logh, "Upload file: $uploadfile\n");
    if (move_uploaded_file($_FILES['FILE1']['tmp_name'], $uploadtmp)) {
        tee($logh, "File successfully uploaded to $uploadtmp.\n");
    } else {
        tee($logh, "File upload not successful: $uploadfile.\n");
    }

    //Remove this IF statement if you don't want to save images
    if (file_exists($uploadfile) && file_exists($uploadtmp)) { 
        $archivefile = basename($uploadfile, ".jpg") . "-$timestamp.jpg";
        rename ($uploadfile, $archivefile);
        tee ($logh, "Renaming $uploadfile => $archivefile\n");
    }
    rename ($uploadtmp, $uploadfile);
    tee ($logh, "Renaming $uploadtmp => $uploadfile\n");

    tee($logh, "\nDebugging Info:\n");
    foreach ($_FILES as $key => $value)
        tee($logh, "FILES: $key => $value\n");
    foreach ($_FILES['FILE1'] as $key => $value)
        tee($logh, "FILE1: $key => $value\n");
    foreach ($_POST as $key => $value)
        tee($logh, "POST: $key => $value\n");
print "</pre>;\n";
fclose($logh);
?>