Gossamer Forum
Home : Products : DBMan : Customization :

problem with multiple file upload

Quote Reply
problem with multiple file upload
ok, i have multiple file upload working great using an array with specific filenames for full-size and thumbnail images. now i've added an "Add duplicate record" feature to copy some of the fields to the next record. I've created a form on the add_success page that adds a duplicate record by calling this sub in html:

Code:
sub html_add_duplicate {
#-------------------------------------------------------------
# form upload hack delicia
$form_upload_add =1; $page_title = "$html_title: Add duplicate";
&html_page_top;



print qq|
<FORM action="$db_script_url" method="GET">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
|;



$in{'dbkey'} =~ s/<.?B>//g;
my (%rec) = &get_record($in{'dbkey'});
html_record_form(&get_defaults2(%rec));



print qq|</TD></TR>
<TR><TD><CENTER>
<INPUT TYPE="SUBMIT" NAME="add_record" VALUE="Add Record">
<INPUT TYPE="RESET" VALUE="Reset Form"></CENTER></TD></TR>
<TR><TD> |;



&html_footer;
&html_page_bottom;
}


then, in db.cgi i have new subroutine get_defaults2:

Code:


sub get_defaults2 {

# --------------------------------------------------------

# Returns a hash of the defaults used for a new record.

my (%prev) = @_; #hack

my (%default);

foreach $field (keys %db_defaults) {

$default{$field} = $db_defaults{$field};

}

#######hack

@fields = split (/\,/, $db_copy_previous{$column});

foreach $field (%db_copy_previous) {

$default{$field} = $prev{$field};

}

#######

## hack delicia

unless ($per_admin) { ($auth_user_field >=0) and ($db_defaults{$db_cols[$auth_user_field]} = $db_userid); }

###



if ($db_key_track) {

open (ID, "<$db_id_file_name") or &cgierr("error in get_defaults. unable to open id file: $db_id_file_name.\nReason: $!");

if ($db_use_flock) { flock(ID, 1); }

$default{$db_key} = <ID> + 1; # Get next ID number

close ID;

}

return %default;

}


this seems to work fine for getting the default values. (i have an array in cfg similar to the radio button definitions to list the fields for copy_previous.)

my problem is that when i choose add duplicate it looks like everything is working but my files are not getting uploaded. dbman is creating my two files but they are both 0 bytes. help please !!!
Subject Author Views Date
Thread problem with multiple file upload delicia 3075 Dec 8, 2003, 7:21 AM
Thread Re: [delicia] problem with multiple file upload
delicia 2973 Dec 9, 2003, 6:37 PM
Thread Re: [delicia] problem with multiple file upload
Watts 2974 Dec 10, 2003, 7:33 AM
Post Re: [Watts] problem with multiple file upload
delicia 2960 Dec 10, 2003, 2:06 PM