Gossamer Forum
Home : Products : DBMan SQL : Discussion :

file_upload mod ..delete problem...

Quote Reply
file_upload mod ..delete problem...
Hi all....
I'm still working on converting JPDeni 's "file_upload mod" to Dbsql...
all is working fine except when I delete a record..the code below will not delete the corresponding graphic...
I've tried numerous alterations to the code but no success....can anyone assist??? thanks Rob

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 = $data[$db_key_pos];
foreach $file (@files) {
if ($file =~ /^$file_test\./) {
unlink ("$SAVE_DIRECTORY/$file");
}
}
}
}
else { $output .= $line . "\n"; }


Quote Reply
Re: file_upload mod ..delete problem... In reply to
Got it...Rob

Quote Reply
Re: file_upload mod ..delete problem... In reply to
It would help other users if you post the solution.

Regards,

Eliot Lee
Quote Reply
Re: file_upload mod ..delete problem... In reply to
Please post the solutions

thanks

Quote Reply
Re: file_upload mod ..delete problem... In reply to
Hi All....
I alter the orginal code to the following....
and inserted it right after ....

$rc = $DBH->do($query);

.....seems to work fine...hope it helps...thanks Rob
Happy New Years


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 = $key;
foreach $file (@files) {
if ($file =~ /^$file_test\./) {
unlink ("$SAVE_DIRECTORY/$file");
}
}
}

Quote Reply
Re: file_upload mod ..delete problem... In reply to
Hi,
I was searching the DBman SQL forum for details on how to modify JP Deni's upload mod to work with DBman SQL and I came accross your post.
Can you tell me what I need to do to modify it??
Any advice would be most welcomed.
Thank you.
Simon.

Quote Reply
Re: file_upload mod ..delete problem... In reply to
The line
$rc = $DBH->do($query);

... appears 6 times in db.cgi. Are you referring to just the delete record syubroutine OR all instances?