Gossamer Forum
Home : Products : DBMan : Customization :

Upload and display non image files

Quote Reply
Upload and display non image files
I am using the upload mod to up load 2 files but the problem i have is one of the is a zip file not a image. The script looks in the upload directory and then
displays all the files with a <img src= tag I would like to change this part here that says
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
print qq|

to some thing like

foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
if ($file =~ /^.zip/);
print qq|
<a href= www.path-name-to-file.zip></a></p>|;

now print any image files that you found in the folder



If some one could show me how to do this I would be most great full

Quote Reply
Re: Upload and display non image files In reply to
Try:

Code:
my $url = "http://www.mydomain.com/files";
Code:
foreach (@files) {
(/^\./) and next;
(/^index/) and next;
if (/\.zip$/) {
print qq|<a href="$url/$_">$_</a></p>|;
} else {
print qq|
<img src="$url/$_"></p>|;
}
}
Installs:http://wiredon.net/gt
FAQ:http://www.perlmad.com

Quote Reply
Re: Upload and display non image files In reply to
 
You may want to check out the the section "Images" in the FAQ noted below


Image Upload - pass as binary or ascii

Image Upload</A> (Show link rather then photo in display)

There are probably others but these may help get you started. It doesn't hurt to read all related threads when using a mod.

You might want to be sure in the following line you have the extension for zip files:

$ALLOWED_EXT = '\.gif$|\.jpg$|\.doc$|\.pdf$|\.zip$|\.htm$l|\.GIF$|\.JPG$|\.DOC$|\.PDF$|\.ZIP$|\.HTM$';

Hope this helps

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Upload and display non image files In reply to
Thank you Paul, it worked first time just made a few changes and i have it working just as i wanted it. Thank you again for your help. ps trying to find any thing in this forum has become a right pain, it has got so big, but its guess it is ok vets who come here every day and our use to the layout just i find it hard to find certain things in the groups.

Quote Reply
Re: Upload and display non image files In reply to
I sympathise with your point about searching for mods. It cries our for a categorised dbase, but this would require a huge amount of work by someone. No one would be able to spend the time categorising it now, because of its shear size.
Fortunately, there are members and vets who do not mind pointing us in the right direction. Many of us were not around this place 2 years ago, or more, and getting search terms right is very "hit and miss".

David Olley
Anglo & Foreign International Limited,
http://www.afil.co.uk
Quote Reply
Re: Upload and display non image files In reply to
Many of the threads and tips and tricks are referenced in the FAQ noted below.

I spent over a year creating this FAQ and continue to add references to all the useful threads.

It's a good place to start your search for ideas, possibilities, and solutions for your database.

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/