believe it or not, i've accomplished a lot without having to ask questions! but here's another one.
i'm trying to make all the hacks work with autogenerate. i have file upload, instant modify/delete, and some others working fine. i want to tweak the file upload a little. instead of testing by the fieldname = Filename, i would prefer to change the field type to file (instead of alpha) and use that field (i think it's $db_sort). that way i could have a more descriptive fieldname for the file without having to use a custom html or modifying for each application/database.
db.cgi has following in sub add_record:
my ($output, $status, $counter);
# Set the userid to the logged in user.
($auth_user_field >= 0) and ($in{$db_cols[$auth_user_field]} = $db_userid);
# First we validate the record to make sure the addition is ok.
$status = &validate_record;
# We keep checking for the next available key, or until we've tried 50 times
# after which we give up.
while ($status eq "duplicate key error" and $db_key_track) {
return "duplicate key error" if ($counter++ > 50);
$in{$db_key}++;
$status = &validate_record;
}
###
if (($status eq "ok") && ($in{'Filename'})) { $status = &validate_upload; } #Validate Picture
#####
it's the last line above $in{'Filename'} that i want to change the test to ?? eq 'File'. i can't figure out where to start. it seems that if Filename is available here, the data type should also be available.
then in modify_record:
$db_not_null{'Filename'} = 0;
i need to do something similar here - help!
i'm trying to make all the hacks work with autogenerate. i have file upload, instant modify/delete, and some others working fine. i want to tweak the file upload a little. instead of testing by the fieldname = Filename, i would prefer to change the field type to file (instead of alpha) and use that field (i think it's $db_sort). that way i could have a more descriptive fieldname for the file without having to use a custom html or modifying for each application/database.
db.cgi has following in sub add_record:
Code:
my ($output, $status, $counter);
# Set the userid to the logged in user.
($auth_user_field >= 0) and ($in{$db_cols[$auth_user_field]} = $db_userid);
# First we validate the record to make sure the addition is ok.
$status = &validate_record;
# We keep checking for the next available key, or until we've tried 50 times
# after which we give up.
while ($status eq "duplicate key error" and $db_key_track) {
return "duplicate key error" if ($counter++ > 50);
$in{$db_key}++;
$status = &validate_record;
}
###
if (($status eq "ok") && ($in{'Filename'})) { $status = &validate_upload; } #Validate Picture
#####
it's the last line above $in{'Filename'} that i want to change the test to ?? eq 'File'. i can't figure out where to start. it seems that if Filename is available here, the data type should also be available.
then in modify_record:
Code:
$db_not_null{'Filename'} = 0;
i need to do something similar here - help!