Gossamer Forum
Home : Products : DBMan : Customization :

File upload mod - strange outcome

Quote Reply
File upload mod - strange outcome
Hi,

I just edited my files to use the file upload mod, but i have some strange outcome.

i used in html.pl - sub html_record

|; # to close off a previous print qq| statement
$ALLOWED_EXT =~ s/\\.//g;
$ALLOWED_EXT =~ s/\$//g;
@extensions = split (/\Q|\E/o,$ALLOWED_EXT);
GRAPHIC: foreach $extension (@extensions) {
if (-e "$SAVE_DIRECTORY/$rec{$db_key}.$extension") {
print qq|<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}.$extension">|;
last GRAPHIC;
}
}
print qq|

But i saw no picture after uploading. I placed the word 'test' just before the |; and the word 'test' appeared.

I have also inserted this line in db.cgi - 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) {
$ALLOWED_EXT =~ s/\\.//g;
$ALLOWED_EXT =~ s/\$//g;
@extensions = split (/\Q|\E/o,$ALLOWED_EXT);
foreach $extension (@extensions) {
(-e "$SAVE_DIRECTORY/$data[$db_key_pos].$extension") && (unlink "$SAVE_DIRECTORY/$data[$db_key_pos].$extension")
}
}
}
else { $output .= $line . "\n"; }

And after the deletion of the record the uploaded file is also deleted (i checked) so the file handling seems to be okay!...

I tried to use this to overcome the 'error' in html.pl:

<img src= "path_to_my_gfx_dir/$rec{$db_key}.jpg">

But now every entry withoud a gfx shows a 'broken picture', not quite elegant :-(

I hope someone can tell me what's whrong..

Regards,
Michiel
Quote Reply
Re: File upload mod - strange outcome In reply to
did you add this at the top of your sub?

$rec{$db_key} =~ s/<.?B>//g;

Code:
my (%rec) = @_; # Load any defaults to put in the VALUE field.
$rec{$db_key} =~ s/<.?B>//g;
($db_auto_generate and print &build_html_record(%rec) and return);