Gossamer Forum
Home : Products : DBMan : Customization :

file upload error message

Quote Reply
file upload error message
Hi all

I attempted to install JP Deni's file upload mod. Im almost certain i did it all in the correct order...ish. I get an error message on my server log saying premature end of script headers in /home/blah/blah/cgi-bin/dbman/dbman.cgi if anyone knows what this means please let me know so I'll know what not to do on my next attempt.

Thanks

Roger
Quote Reply
Re: [jollyroger] file upload error message In reply to
It would help to be able to see your files. Please create a .txt copy of your .cfg, html.pl and db.cgi files and provide the urls to where they could be viewed someone here will look over your changes and try and track down the error.

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [LoisC] file upload error message In reply to
Hiya

Thanks for your reply and the kind offer to look over the script, but I deleted it in a mild temper tantrum. Anyway I started from square one again reading JPDeni's tutorial extra careful and it works fine, whatever I did, I didnt do it again. But then another problem arose. Im using the short and long mod with multiple file upload. It was all going fine untill I added the default graphic feature which I borrowed from the single file upload mod, and now it displays the default graphic as well as the uploaded graphic. I tried allowing only one grahic but no dice. The record display bit looks like this...
<TR><TD>|;
if (-e "$SAVE_DIRECTORY/$rec{$db_key}") {
opendir (GRAPHIC, "$SAVE_DIRECTORY/$rec{$db_key}") or &cgierr("unable to open directory: $SAVE_DIRECTORY/$rec{$db_key}. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
print qq|<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$file">|;
}
}
print qq|
|;
unless ($graphic_found) {
print qq|<img src="http://server.com/.../default_graphic.gif">|;
}
print qq|

</TD></TR>
</TABLE>
|;

}

Incidently Im a newcomer to dbman and all I know about perl is what Ive read on JPDeni's site.

Thanks v much

Roger
Quote Reply
Re: [jollyroger] file upload error message In reply to
Looks okay .. I just added one line that I use for this mod.

$graphic_found=1; #### added this line

Let me know if that worked.

=======

<TR><TD>|;
if (-e "$SAVE_DIRECTORY/$rec{$db_key}") {
opendir (GRAPHIC, "$SAVE_DIRECTORY/$rec{$db_key}") or &cgierr("unable to open directory:
$SAVE_DIRECTORY/$rec{$db_key}. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
print qq|<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$file">|;
$graphic_found=1; #### added this line
}
}

unless ($graphic_found) {
print qq|<img src="http://server.com/uploads/default_graphic.gif">|;
}
print qq| </TD></TR></TABLE> |;
}

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [LoisC] file upload error message In reply to
Hiya

Yes that did work, thanks v much, although it still shows the default grapic for records that allready have a graphic, but new additions are no problem and existing records can be modified ok. The database is working perfectly for my needs, but if you know of another snippet to cure the existing graphic thingy that would be great but no stress theres not much data in it so its not really a problem.

Thanks again

Roger
Quote Reply
Re: [jollyroger] file upload error message In reply to
Did you include a field called "Graphic" in your .cfg file?

If so try surrounding the code with the if ($rec{'Graphic'} eq "Yes") { statement:

|;
if ($rec{'Graphic'} eq "Yes") { ## add this
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\./) {
print qq|<img src="$SAVE_DIRECTORY_URL/$file" ALT="$rec{'Title'}" BORDER=0 ALIGN=Middle>|;
$graphic_found=1;
}
}
} ## closing for if graphic
unless ($graphic_found) { print qq| $defaultgif |;
}
print qq|

Sorry I missed that the first time around. You can also do as I have by defining your graphic as a variable:

sample: $defaultgif

within your .cfg file and use a relative path to your image directory, for example:

$defaultgif ='<IMG SRC="../images/default.gif" ALT="[ No photo]" width=150 height=150 BORDER=0 ALIGN=Middle>';

Hopefully the code above will show the graphic or default appropriately.

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/