When you have a problem with a mod it's best to go over the instructions again and be sure you have followed all the changes called for :)
You didn't say whether you were requiring users to upload an image or not.
In your sub add_record within the .cgi file you are missing the portion
IN sub add_record
If you *DO NOT* want to require all users to upload a file when they add a record, *AND* you have added the 'Graphic' field to your field definitions, AFTER THE LINE YOU ADDED ABOVE, add :
##############################################
opendir (GRAPHIC, "$SAVE_DIRECTORY") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORY. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
$file_test = $rec{$db_key};
foreach $file (@files) {
if ($file =~ /^$file_test\./) {
$in{'Graphic'} = 'Yes';
$graphic_found=1;
}
}
unless ($graphic_found) { $in{'Graphic'} = ''; }
You also don't have the changes to sub modify_record in your db.cgi file:
opendir (GRAPHIC, "$SAVE_DIRECTORY") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORY. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
$file_test = $rec{$db_key};
foreach $file (@files) {
if ($file =~ /^$file_test\./) {
$in{'Graphic'} = 'Yes';
$graphic_found=1;
}
}
unless ($graphic_found) { $in{'Graphic'} = ''; }
In sub delete_records - you are missing a } which would cause errors within the script:
if ($delete_list{$data[$db_key_pos]}) { # if this id is one we want to delete
$delete_list{$data[$db_key_pos]} = 0; # then mark it deleted and don't print it to the new database.
if ($db_upload) {
opendir (GRAPHIC, "$SAVE_DIRECTORY") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORY. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
$file_test = $rec{$db_key};
foreach $file (@files) {
if ($file =~ /^$file_test\./) {
unlink ("$SAVE_DIRECTORY/$file");
}
}
}
}
else { $output .= $line . "\n";
}
####### end replacements for file upload ###########
}
foreach $key (keys %delete_list) {
Hope this gets you up and running.
Unoffical DBMan FAQ
http://creativecomputingweb.com/dbman/index.shtml/