Hello.
I am using the dbman long/short HTML file with the multi-upload mod. works fine except that if you add a record, and don't add an image, the script gives an error "unable to open directory in delete records"
I need the program to delete the image when a record is deleted to save server space, but also need the script to delete a record if there is no image with it.
I suspect the problem exists here...in sub delete_records
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/$data[$db_key_pos]") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORY/$data[$db_key_pos]. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
foreach $file (@files) {
unlink ("$SAVE_DIRECTORY/$data[$db_key_pos]/$file");
}
rmdir "$SAVE_DIRECTORY/$data[$db_key_pos]";
}
}
else { $output .= $line . "\n"; }
POC Web Services - www.POC.us
I am using the dbman long/short HTML file with the multi-upload mod. works fine except that if you add a record, and don't add an image, the script gives an error "unable to open directory in delete records"
I need the program to delete the image when a record is deleted to save server space, but also need the script to delete a record if there is no image with it.
I suspect the problem exists here...in sub delete_records
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/$data[$db_key_pos]") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORY/$data[$db_key_pos]. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
foreach $file (@files) {
unlink ("$SAVE_DIRECTORY/$data[$db_key_pos]/$file");
}
rmdir "$SAVE_DIRECTORY/$data[$db_key_pos]";
}
}
else { $output .= $line . "\n"; }
POC Web Services - www.POC.us