...

View Full Version : Bad name after fatalsToBrowser Error (Uber Upload)



theflyingminstr
02-14-2010, 04:25 PM
Hi I'm trying to run a Perl CGI script using Uber Upload with xampp and I get this Flength file error in the browser.

When I check the error log I see: Bad name after fatalsToBrowser

What in the heck does that mean? Does this mean the versn of Perl I'm using is incompatible? That's the only thing I can think of right now..

Thanks for reading this post.

Your help/comments would be much appreciated.

FishMonger
02-14-2010, 04:54 PM
Please post your perl script.

theflyingminstr
02-14-2010, 05:07 PM
Thanks for responding F.M.

Here:

ubr_upload.pl (cgi-bin)



#!C:\inetpub\wwwroot\xampp\perl\bin -w
#*************************************************************************************************** *******************************
# ATTENTION: THIS FILE HEADER MUST REMAIN INTACT. DO NOT DELETE OR MODIFY THIS FILE HEADER.
#
# Name: ubr_upload.pl
# Link: http://uber-uploader.sourceforge.net/
# Revision: 1.5
# Date: 2/27/2008 8:03:02 PM
# Initial Developer: Peter Schmandra
# Description: Upload files to a temp dir based on upload id, transfer files to upload dir and redirects.
#
# Licence:
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
#*************************************************************************************************** *******************************

#****************************************************************************************
# ATTENTION: The $TEMP_DIR values MUST be duplicated in the "ubr_ini.php" file
#****************************************************************************************
my $TEMP_DIR = 'C:\inetpub\wwwroot\test\video\tmp\uploader\'; # MUST be duplicated in the "ubr_ini.php" file

$|++; # Auto flush output buffer

use strict; # Insert whipping sound here
use CGI::Carp 'fatalsToBrowser'; # Dump fatal errors to screen
use CGI qw(:cgi); # Load the CGI.pm module
use File::Copy; # Module for moving uploaded files
use File::Path; # Module for creating and removing directories

my $UBER_VERSION = "6.3.2"; # Version of UU
my $THIS_VERSION = "1.5"; # Version of this script
my $UPLOAD_ID = ''; # Initialize upload id

# Makes %ENV safer
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};

###############################################################
# The following possible query string formats are assumed
#
# 1. ?upload_id=32_alpha_numeric_string
# 2. ?about=1
###############################################################
my %query_string = parse_query_string($ENV{'QUERY_STRING'}); # Parse query string
my $print_issued = 0; # Track print statement
my $remove_temp_dir = 0; # Track remove upload_id.dir

# Check for tainted upload id
if(exists($query_string{'upload_id'})){
if($query_string{'upload_id'} !~ m/(^[a-zA-Z0-9]{32}$)/){ &kak("<font color='red'>ERROR<\/font>: Invalid upload id<br>\n", 1, __LINE__); }
else{ $UPLOAD_ID = $1; }
}
elsif(exists($query_string{'about'})){
if($query_string{'about'} == 1){ &kak("<u><b>UBER UPLOADER VERSION</b><\/u><br> UBER UPLOADER VERSION = <b>" . $UBER_VERSION . "<\/b><br> UBR_UPLOAD = <b>" . $THIS_VERSION . "<\/b><br>\n", 1, __LINE__); }
}
else{ &kak("<font color='red'>ERROR</font>: Invalid parameters passed<br>\n", 1, __LINE__); }

my $start_upload = 0; # Timestamp start of upload
my $end_upload = 0; # Timestamp end of upload
my $sleep_time = 1; # Seconds to wait before upload proceeds (for small file uploads)
my %uploaded_files = (); # Hash used to store uploaded file names, sizes and types
my %config = &load_config_file($TEMP_DIR, $UPLOAD_ID); # Hash containig configuration settings
my $temp_dir_id = $TEMP_DIR . $UPLOAD_ID . '.dir'; # The upload dir appendided to the temp dir
my $flength_file = $temp_dir_id . '/' . $UPLOAD_ID . '.flength'; # Flength file is used to store the size of the upload in bytes
my $redirect_file = $TEMP_DIR . $UPLOAD_ID . '.redirect'; # Redirect file (upload id.redirect)

# Dump info to screen and exit if $DEBUG_UPLOAD=1
if($config{'debug_upload'}){ &show_debug_info($UBER_VERSION, $THIS_VERSION, $TEMP_DIR, $UPLOAD_ID, %config); }

umask(0);
$SIG{HUP} = 'IGNORE'; # Ignore sig hup
$CGI::POST_MAX = $config{'max_upload_size'}; # Set the max post value
$CGI::PRIVATE_TEMPFILES = 0; # Disable private temp files

# Create a temp directory based on upload id
mkpath($temp_dir_id, 0, 0777) or die("Failed to make $temp_dir_id: $!\n");

# Prepare the flength file for writing
open(FLENGTH, ">" , "$flength_file") or &kak("<font color='red'>ERROR</font>: Failed to open flength file $flength_file: $!", 1, __LINE__);

if($ENV{'CONTENT_LENGTH'} > $config{'max_upload_size'}){
# If file size exceeds maximum write error to flength file and exit
my $max_size = &format_bytes($config{'max_upload_size'}, 99);

print FLENGTH "<font color='red'>ERROR</font>: Maximum upload size of $max_size exceeded";
close(FLENGTH);
chmod 0666, $flength_file;

&kak("<font color='red'>ERROR</font>: Maximum upload size of $max_size exceeded.<br>", 1, __LINE__);
}
else{
# Write total upload size in bytes to flength file
print FLENGTH $ENV{'CONTENT_LENGTH'};
close(FLENGTH);
chmod 0666, $flength_file;

# Clean up upload_id.dir when the script exits
$remove_temp_dir = 1;
}

# Let progress bar get some info (for small file uploads)
sleep($sleep_time);

# Timestamp start of upload
$start_upload = time();

# Tell CGI.pm to use our directory based on upload id
if($TempFile::TMPDIRECTORY){ $TempFile::TMPDIRECTORY = $temp_dir_id; }
elsif($CGITempFile::TMPDIRECTORY){ $CGITempFile::TMPDIRECTORY = $temp_dir_id; }
else{ &kak("<font color='red'>ERROR</font>: Failed to assign CGI temp directory", 1, __LINE__); }

my $query = new CGI;
#################################################################################################### ################
# The upload is complete at this point, so you can now access post values. eg. $query->param("some_post_value");
#################################################################################################### ################




.. there's more but it doesn't get past this point and I can't post such a long post anywho..


ubr_ini.php (root /test)



<?php
//**************************************************************************************************** **
// ATTENTION: THIS FILE HEADER MUST REMAIN INTACT. DO NOT DELETE OR MODIFY THIS FILE HEADER.
//
// Name: ubr_ini_progress.php
// Revision: 1.3
// Date: 2/18/2008 5:35:48 PM
// Link: http://uber-uploader.sourceforge.net
// Initial Developer: Peter Schmandra http://www.webdice.org
// Description: Initializes Uber-Uploader
//
// Licence:
// The contents of this file are subject to the Mozilla Public
// License Version 1.1 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of
// the License at http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS
// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
// implied. See the License for the specific language governing
// rights and limitations under the License.
//
//**************************************************************************************************** ***********

if ( !isset($config['BASE_DIR']) ) {
require('include/config.php');
}

$TEMP_DIR = $config['BASE_DIR']. '/tmp/uploader/'; // *ATTENTION : The $TEMP_DIR values MUST be duplicated in the "ubr_upload.pl" file

$UBER_VERSION = '6.3.2'; // Version of Uber-Uploader
$PATH_TO_UPLOAD_SCRIPT = '/test/video//cgi-bin/ubr_upload.pl'; // Path info
$PATH_TO_LINK_SCRIPT = 'ubr_link_upload.php'; // Path info
$PATH_TO_SET_PROGRESS_SCRIPT = 'ubr_set_progress.php'; // Path info
$PATH_TO_GET_PROGRESS_SCRIPT = 'ubr_get_progress.php'; // Path info
$PATH_TO_JS_SCRIPT = 'ubr_file_upload.js'; // Path info
$DEFAULT_CONFIG = 'ubr_default_config.php'; // Path info
$MULTI_CONFIGS_ENABLED = 0; // Enable/Disable multi config files
$GET_PROGRESS_SPEED = 1000; // 1000=1 second, 500=0.5 seconds, 250=0.25 seconds etc.
$DELETE_LINK_FILE = 1; // Enable/Disable delete link file
$DELETE_REDIRECT_FILE = 1; // Enable/Disable delete redirect file
$PURGE_LINK_FILES = 1; // Enable/Disable delete old upload_id.link files
$PURGE_LINK_LIMIT = 60; // Delete old upload_id.link files older than X seconds
$PURGE_REDIRECT_FILES = 1; // Enable/Disable delete old upload_id.redirect files
$PURGE_REDIRECT_LIMIT = 60; // Delete old redirect files older than X seconds
$PURGE_TEMP_DIRS = 1; // Enable/Disable delete old upload_id.dir directories
$PURGE_TEMP_DIRS_LIMIT = 43200; // Delete old upload_id.dir directories older than X seconds (43200=12 hrs)
$TIMEOUT_LIMIT = 6; // Max number of seconds to find the flength file
$DEBUG_AJAX = 0; // Enable/Disable AJAX debug mode. Add your own debug messages by calling the "showDebugMessage() " function. UPLOADS POSSIBLE.
$DEBUG_PHP = 0; // Enable/Disable PHP debug mode. Dumps your PHP settings to screen and exits. UPLOADS IMPOSSIBLE.
$DEBUG_CONFIG = 0; // Enable/Disable config debug mode. Dumps the loaded config file to screen and exits. UPLOADS IMPOSSIBLE.
$DEBUG_UPLOAD = 0; // Enable/Disable debug mode in uploader. Dumps your CGI and loaded config settings to screen and exits. UPLOADS IMPOSSIBLE.
$DEBUG_FINISHED = 0; // Enable/Disable debug mode in the upload finished page. Dumps all values to screen and exits. UPLOADS POSSIBLE.
$PHP_ERROR_REPORTING = 0; // Enable/Disable PHP error_reporting(E_ALL). UPLOADS POSSIBLE.

?>

FishMonger
02-14-2010, 05:36 PM
The problem is with this line:

my $TEMP_DIR = 'C:\inetpub\wwwroot\test\video\tmp\uploader\';

The '\' backslash is the escape character, so if you want a literal '\' then you need to double it up to escape it.

my $TEMP_DIR = 'C:\\inetpub\\wwwroot\\test\\video\\tmp\\uploader\\';

Or the better option would be to use '/' forward slashes.

my $TEMP_DIR = 'C:/inetpub/wwwroot/test/video/tmp/uploader/';

theflyingminstr
02-14-2010, 05:44 PM
Holy Jebis.. Sorry to bring such a stupid error into this forum.. Hopefully it'll help someone else out who may have been as careless as I..

Much thanks to you!

FishMonger
02-14-2010, 09:25 PM
I get caught by simple mistakes like that more times than I want to admit. :o That's why it's good to have 2 or more pairs of eyes looking at it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum