Gossamer Forum
Home : Products : DBMan : Customization :

JPDeni FILE UPLOAD MOD - question about changes to sub parse_form

Quote Reply
JPDeni FILE UPLOAD MOD - question about changes to sub parse_form
I am currently incorporating the MULTIPLE FILE UPLOAD MOD from JPDeni, after successfully incorporating several other mods, including adding permissions, bug fixes, user-friendly HTML file, counter script, newest record mod, and preview record mod.

But, I am having a hang-up with the MISC CHANGES mod. Specifically, in having to replace the sub parse_form, because the changes in this mod are mutually exclusive to the changes in the MULTIPLE FILE UPLOAD mod.

Could you tell me the replacement code that would incorporate both changes from the first mod with the funcionality of the multiple file upload mod?

Thanks!
Quote Reply
Re: [agrathea] JPDeni FILE UPLOAD MOD - question about changes to sub parse_form In reply to
I think I may have sorted it out myself... So, if this looks wrong, please let me know!

Everything below, except for two lines, are directly from the Multiple File Upload Mod:




sub parse_form {
# --------------------------------------------------------
my (%in);
my ($buffer, $pair, $name, $value);

PAIR: foreach $name ($query->param()) {
$value = $query->param("$name");
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
if ($value eq "---") { next PAIR; }



The following two lines are inserted from the Misc. Changes Mod:




if ($value eq "http://") { next PAIR; } # Removes default beginning of URLs
unless ($value) { next PAIR; } # Eliminates false multiple selections




The rest is from the Upload Mod:




(exists $in{$name}) ?
($in{$name} .= "~~$value") :
($in{$name} = $value);
}
return %in;
}




Thanks for your time!