https://www.icyphoenix.com/viewtopic.php?f=26&t=2497
-----------------------------------
william_hunter
Fri 20 Jul, 2007 15:30

FAP SUPPORT - Cannot Upload Pics
-----------------------------------
Hi, new user, first post  :shock: 

I am having a problem with the FAP version 1.4.1 (yes, I know there is a newer version, but I didn't when I modded my forum and I don't want to upgrade just yet). I try uploading a pic with nuffload and I get this:

[quote]
#!/usr/bin/perl -W

# Author : Nuffmon 2005
# http://www.nuffmon.oftheweek.de
# Version 1.4.2
# Last Update 19/11/2005
#
# The Initial Developer of the Original Code is Raditha Dissanayake.
# Portions created by Raditha are Copyright (C) 2003
# Raditha Dissanayake. All Rights Reserved.


use CGI;
use CGI::Carp qw(fatalsToBrowser);

my $qstring = "";

if (length ($ENV{'QUERY_STRING'}) > 0){
      $buffer = $ENV{'QUERY_STRING'};
      @pairs = split(/&/, $buffer);
      foreach $pair (@pairs){
           ($name, $value) = split(/=/, $pair);
           $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
           $$name = $value;
           $qstring .= "$name=$value&";
      }
 }
$psid =~ s/[^a-zA-Z0-9]//g;

$post_data_file = "tmp/" . $psid . "_postdata";
$monitor_file = "tmp/" . $psid . "_flength";
$qstring_file = "tmp/" . $psid . "_qstring";

$len = $ENV{'CONTENT_LENGTH'};
$bRead=0;
$|=1;

# Check for max upload size, set to whatever you want
if($len > 32000000)
{
  close (STDIN);
  print "Content-type: text/htmlnn";
  print "<br>The maximum upload size has been exceeded<br>n";
  exit;
}

# Send content-length to monitor file
if (-e "$monitor_file") {
  unlink("$monitor_file");
}
open (MF,">", "$monitor_file") or die "can't open monitor file";
print MF $len;
close (MF);
sleep(1);

# read and store the raw post data on a temporary file so that we can
# pass it though to a CGI instance later on.
if (-e "$post_data_file") {
  unlink("$post_data_file");
}
open(TMP,">","$post_data_file") or &bye_bye ("can't open temp file");
my $i=0;
$ofh = select(TMP); $| = 1; select ($ofh);
while (read (STDIN ,$LINE, 4096) && $bRead < $len )
{
  $bRead += length $LINE;
  $i++;
  print TMP $LINE;
}
close (TMP);

#
# We don't want to decode the post data ourselves. That's like
# reinventing the wheel. If we handle the post data with the perl
# CGI module that means the PHP script does not get access to the
# files, but there is a way around this.
#
# We can ask the CGI module to save the files, then we can pass
# these filenames to the PHP script. In other words instead of
# giving the raw post data (which contains the 'bodies' of the
# files), we just send a list of file names.
#

open(STDIN,"$post_data_file") or die "can't open temp file";
my $cg = new CGI();
my %vars = $cg->Vars;
my $j = 0;

while(($key,$value) = each %vars)
{
  $file_upload = $cg->param($key);
  if(defined $value && $value ne '')
  {
    my $fh = $cg->upload($key);
    if(defined $fh)
    {
      $tmp_filename = "tmp/$psid"."_actualdata"."$j";
      open(TMP,">","$tmp_filename") or &bye_bye ("can't open temp file");
      while(<$fh>) {
        print TMP $_;
      }
      close(TMP);
      $fsize =(-s $fh);
      $fh =~ s/([^a-zA-Z0-9_-.])/uc sprintf("%%%02x",ord($1))/eg;
      $tmp_filename =~ s/([^a-zA-Z0-9_-.])/uc sprintf("%%%02x",ord($1))/eg;
      $qstring .= "file[name][$j]=$fh&file[size][$j]=$fsize&";
      $qstring .= "file[tmp_name][$j]=$tmp_filename&";
      $qstring .= "file[field][$j]=$key&";
      $j++;
    }
    else
    {
      $value =~ s/([^a-zA-Z0-9_-.])/uc sprintf("%%%02x",ord($1))/eg;
      $qstring .= "$key=$value&" ;
    }
  }
}

# Write query string to file.
if (-e "$qstring_file") {
  unlink("$qstring_file");
}
open (QSTR,">", "$qstring_file") or die "can't open output file";
print QSTR $qstring;
close (QSTR);

# Tidy up after ourselves.
unlink("$monitor_file");
unlink("$post_data_file");

# OK lets get back to album upload.
my $url= $redirect . "?psid=$psid";
print "Location: $urlnn";
[/quote]

Each and every time I try to upload.  I have no idea what's going on. Anyone?


-----------------------------------
Artie
Sat 21 Jul, 2007 00:57

Re: Cannot Upload Pics
-----------------------------------
Maybe possible that your server's path to Perl is different from that called for by this line

[codeblock]#!/usr/bin/perl -W [/codeblock]

Is there a certain reason you need to use Nuffload instead of the standard upload.


FYI: FAP version 1.4.1 is the latest release for standard phpBB


-----------------------------------
william_hunter
Sat 21 Jul, 2007 03:41

Re: Cannot Upload Pics
-----------------------------------
No, no real reason to use nuffload, I just thought I would try it to see if that would work. I get an error message like this when I don't use nuffload:

[spoiler]
[quote]
DEBUG :
----------------------------------------------------
album_permissions : before album_user_access : 'Screenshots'(id=0), $album_permission = NULL
----------------------------------------------------
DEBUG :
----------------------------------------------------
album_permissions : after album_user_access : 'Screenshots'(id=0), $album_permission =

array = (
		['view'] => 1,
		['upload'] => 1,
		['rate'] => 1,
		['comment'] => 1,
		['edit'] => 1,
		['delete'] => 1,
		['moderator'] => 1
	)


----------------------------------------------------
DEBUG :
----------------------------------------------------
final : $album_permission =

array = (
		['view'] => 1,
		['upload'] => 1,
		['rate'] => 1,
		['comment'] => 1,
		['edit'] => 1,
		['delete'] => 1,
		['moderator'] => 1,
		['manage'] => 0
	)


----------------------------------------------------
DEBUG :
----------------------------------------------------
album_permissions : before album_user_access : 'Pictures You Want Others to See'(id=0), $album_permission = NULL
----------------------------------------------------
DEBUG :
----------------------------------------------------
album_permissions : after album_user_access : 'Pictures You Want Others to See'(id=0), $album_permission =

array = (
		['view'] => 1,
		['upload'] => 1,
		['rate'] => 1,
		['comment'] => 1,
		['edit'] => 1,
		['delete'] => 1,
		['moderator'] => 1
	)


----------------------------------------------------
DEBUG :
----------------------------------------------------
final : $album_permission =

array = (
		['view'] => 1,
		['upload'] => 1,
		['rate'] => 1,
		['comment'] => 1,
		['edit'] => 1,
		['delete'] => 1,
		['moderator'] => 1,
		['manage'] => 0
	)


----------------------------------------------------
DEBUG :
----------------------------------------------------
album_read_tree : user id = 0, $album_data['auth'] =

array = (
		[1] => array = (
			['view'] => 1,
			['upload'] => 1,
			['rate'] => 1,
			['comment'] => 1,
			['edit'] => 1,
			['delete'] => 1,
			['moderator'] => 1,
			['manage'] => 0
		),
		[2] => array = (
			['view'] => 1,
			['upload'] => 1,
			['rate'] => 1,
			['comment'] => 1,
			['edit'] => 1,
			['delete'] => 1,
			['moderator'] => 1,
			['manage'] => 0
		)
	)


----------------------------------------------------
DEBUG :
----------------------------------------------------
album_read_tree : $cats =

array = (
		[0] => array = (
			['cat_id'] => '1',
			['cat_title'] => 'Screenshots',
			['cat_desc'] => 'Images you gather in game. Sometimes they are funny, sometimes they are evidence.',
			['cat_wm'] => '',
			['cat_order'] => '10',
			['cat_view_level'] => '0',
			['cat_upload_level'] => '0',
			['cat_rate_level'] => '0',
			['cat_comment_level'] => '0',
			['cat_edit_level'] => '0',
			['cat_delete_level'] => '2',
			['cat_view_groups'] => '',
			['cat_upload_groups'] => '',
			['cat_rate_groups'] => '',
			['cat_comment_groups'] => '',
			['cat_edit_groups'] => '',
			['cat_delete_groups'] => '',
			['cat_moderator_groups'] => '',
			['cat_approval'] => '0',
			['cat_parent'] => '0',
			['cat_user_id'] => '0',
			['count'] => '0',
			['username'] => '',
			['parent'] => -1
		),
		[1] => array = (
			['cat_id'] => '2',
			['cat_title'] => 'Pictures You Want Others to See',
			['cat_desc'] => 'Hey, post some pics of yourself if you dare.',
			['cat_wm'] => '',
			['cat_order'] => '20',
			['cat_view_level'] => '0',
			['cat_upload_level'] => '0',
			['cat_rate_level'] => '0',
			['cat_comment_level'] => '0',
			['cat_edit_level'] => '0',
			['cat_delete_level'] => '2',
			['cat_view_groups'] => '5',
			['cat_upload_groups'] => '5',
			['cat_rate_groups'] => '5',
			['cat_comment_groups'] => '5',
			['cat_edit_groups'] => '5',
			['cat_delete_groups'] => '5',
			['cat_moderator_groups'] => '5',
			['cat_approval'] => '0',
			['cat_parent'] => '0',
			['cat_user_id'] => '0',
			['count'] => '0',
			['username'] => '',
			['parent'] => -1
		)
	)


----------------------------------------------------

Warning: Cannot modify header information - headers already sent by (output started at /var/www/phpBB2/album_mod/album_hierarchy_debug.php:77) in /var/www/phpBB2/includes/page_header.php on line 498

Warning: Cannot modify header information - headers already sent by (output started at /var/www/phpBB2/album_mod/album_hierarchy_debug.php:77) in /var/www/phpBB2/includes/page_header.php on line 504

Warning: Cannot modify header information - headers already sent by (output started at /var/www/phpBB2/album_mod/album_hierarchy_debug.php:77) in /var/www/phpBB2/includes/page_header.php on line 505

**
**
**Forum Header Deleted From Here
**
**	
	
DEBUG :
----------------------------------------------------
album_get_auth_keys =

array = (
		['keys'] => array = (
			[-1] => 0,
			[1] => 1,
			[2] => 2
		),
		['id'] => array = (
			[0] => -1,
			[1] => '1',
			[2] => '2'
		),
		['real_level'] => array = (
			[0] => -1,
			[1] => 0,
			[2] => 0
		),
		['level'] => array = (
			[0] => -1,
			[1] => 0,
			[2] => 0
		),
		['idx'] => array = (
			[0] => -1,
			[1] => 0,
			[2] => 1
		)
	)


----------------------------------------------------
DEBUG :
----------------------------------------------------
album_get_auth_keys =

array = (
		['keys'] => array = (
			[-1] => 0,
			[1] => 1,
			[2] => 2
		),
		['id'] => array = (
			[0] => -1,
			[1] => '1',
			[2] => '2'
		),
		['real_level'] => array = (
			[0] => -1,
			[1] => 0,
			[2] => 0
		),
		['level'] => array = (
			[0] => -1,
			[1] => 0,
			[2] => 0
		),
		['idx'] => array = (
			[0] => -1,
			[1] => 0,
			[2] => 1
		)
	)


----------------------------------------------------
DEBUG :
----------------------------------------------------
album_no_newest_pictures sql = 'SELECT c.cat_id, p.pic_id, COUNT(p.pic_id) AS pic_total FROM phpbb_album AS p, phpbb_album_cat AS c WHERE c.cat_id IN (1,2) AND p.pic_cat_id = c.cat_id AND p.pic_time >= 1182389900 GROUP BY c.cat_id'
----------------------------------------------------
DEBUG :
----------------------------------------------------
$pictotalrows =

array = ()


----------------------------------------------------
DEBUG :
----------------------------------------------------
$user_id = 0
$cur_cat_id = -1
$display = 1
album data =

array = (
		['sub'] => array = (
			[-1] => array = (
				[0] => '1',
				[1] => '2'
			)
		),
		['keys'] => array = (
			[1] => 0,
			[2] => 1
		),
		['parent'] => array = (
			[0] => -1,
			[1] => -1
		),
		['id'] => array = (
			[0] => '1',
			[1] => '2'
		),
		['data'] => array = (
			[0] => array = (
				['cat_id'] => '1',
				['cat_title'] => 'Screenshots',
				['cat_desc'] => 'Images you gather in game. Sometimes they are funny, sometimes they are evidence.',
				['cat_wm'] => '',
				['cat_order'] => '10',
				['cat_view_level'] => '0',
				['cat_upload_level'] => '0',
				['cat_rate_level'] => '0',
				['cat_comment_level'] => '0',
				['cat_edit_level'] => '0',
				['cat_delete_level'] => '2',
				['cat_view_groups'] => '',
				['cat_upload_groups'] => '',
				['cat_rate_groups'] => '',
				['cat_comment_groups'] => '',
				['cat_edit_groups'] => '',
				['cat_delete_groups'] => '',
				['cat_moderator_groups'] => '',
				['cat_approval'] => '0',
				['cat_parent'] => '0',
				['cat_user_id'] => '0',
				['count'] => '0',
				['username'] => '',
				['parent'] => -1
			),
			[1] => array = (
				['cat_id'] => '2',
				['cat_title'] => 'Pictures You Want Others to See',
				['cat_desc'] => 'Hey, post some pics of yourself if you dare.',
				['cat_wm'] => '',
				['cat_order'] => '20',
				['cat_view_level'] => '0',
				['cat_upload_level'] => '0',
				['cat_rate_level'] => '0',
				['cat_comment_level'] => '0',
				['cat_edit_level'] => '0',
				['cat_delete_level'] => '2',
				['cat_view_groups'] => '5',
				['cat_upload_groups'] => '5',
				['cat_rate_groups'] => '5',
				['cat_comment_groups'] => '5',
				['cat_edit_groups'] => '5',
				['cat_delete_groups'] => '5',
				['cat_moderator_groups'] => '5',
				['cat_approval'] => '0',
				['cat_parent'] => '0',
				['cat_user_id'] => '0',
				['count'] => '0',
				['username'] => '',
				['parent'] => -1
			)
		),
		['personal'] => array = (
			[1] => 0,
			[2] => 0
		),
		['auth'] => array = (
			[1] => array = (
				['view'] => 1,
				['upload'] => 1,
				['rate'] => 1,
				['comment'] => 1,
				['edit'] => 1,
				['delete'] => 1,
				['moderator'] => 1,
				['manage'] => 0
			),
			[2] => array = (
				['view'] => 1,
				['upload'] => 1,
				['rate'] => 1,
				['comment'] => 1,
				['edit'] => 1,
				['delete'] => 1,
				['moderator'] => 1,
				['manage'] => 0
			)
		)
	)


authentication keys =

array = (
		['keys'] => array = (
			[-1] => 0,
			[1] => 1,
			[2] => 2
		),
		['id'] => array = (
			[0] => -1,
			[1] => '1',
			[2] => '2'
		),
		['real_level'] => array = (
			[0] => -1,
			[1] => 0,
			[2] => 0
		),
		['level'] => array = (
			[0] => -1,
			[1] => 0,
			[2] => 0
		),
		['idx'] => array = (
			[0] => -1,
			[1] => 0,
			[2] => 1
		)
	)


----------------------------------------------------

[/quote]
[/spoiler]

Obviously in debug mode.

Before, I was getting an error message that said something like No Picture Selected For Upload, but that did not happen the last time I tried. I got a blank screen and no redirect. So I enabled debug mode. It looks to me like there is a permissions issue, yes?


