Gossamer Forum
Home : Products : Links 2.0 : Customization :

Upload Mod

Quote Reply
Upload Mod
Hi all, ive been using Links for ages now, in fact the whole site is based around it (its a clan directory)

I tried the file upload mod here http://www.gossamer-threads.com/...orum.cgi?post=237405 so that the clans can upload there banners for show, and to spruce the old listings up a bit.

I done everything in the read me but when the submission was validated no image showed up...and when you click on the link the contact email address shows up on a white page. Can someone help me out here?

*ps, i aint all that good with CGI :(
Quote Reply
Re: [Katie Venra] Upload Mod In reply to
Your add page gives an error, stating it cannot locate links.cfg. In add.cgi, line 30, see this:

require "links.cfg"; # Change this to full path to links.cfg if you have problems.

At the least, it should be "admin/links.cfg"; and if that dosen't work, put the full path to it in ( like /full/site/path/cgi-bin/clans/admin/links.cfg").


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Upload Mod In reply to
OK, ive put the upload mod back now, so it means that anyone who adds there link to our site we wont be able to add it cause the upload mod messes with the link...

go here http://www.stcd.sgnonline.com/pages/

Then click on TEST_BANNER_UPLOADS

I looked at the banners being uploaded, they are actually .txt files and even the pics dont get uploaded, for some reason a .txt file is being written with the senders email address and that is being sent to the 'Attach' folder as an image?

It's got me lost completely :(
Quote Reply
Re: [Katie Venra] Upload Mod In reply to
It's my understanding that this mod will allow EITHER a link to a site, or a link to a file, but not both. The mod you referred to does not add a new field to the database, but puts an existing one (URL) to a different use. It could probably be made to do both, but would require adding a new field to your links database, like 'Upload' or 'Banner' or something.


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Upload Mod In reply to
Ohhhhh :(

Ok 'adding a new field to the database'...thats way above my head :(

Thanks for the info though :) i'll need to look at another system to add banners, or maybe wait a little while longer for another mod to come out...
Quote Reply
Re: [Katie Venra] Upload Mod In reply to
Actually, it's pretty easy, and there are step by step instructions:

http://www.gossamer-threads.com/...or%20dummies;#103461

Now, looking at the readme for the upload mod, in step 2, put the URL back to 1 so that it is required, then add this to the bottom of the field list:

ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes'],
Attach => [14, 'alpha', 40, 75, 0, 'http://', '^http|news|mailto|ftp']


Note the comma added to the end of ReceiveMail, and not one after Attach (if it's the last field in your list).

In step 3, change to this:

# Name of the field in your links.db where the URL of the uploaded
# file will be stored
$attach_file_field = "Attach";

Then in the link.html (templates), putting an <%Attach%> in somewhere should call up the file.

As usual, no guarantees... I did not test this, but it looks reasonable...Angelic


Oops, forgot to mention, you will need to add a pipe "|" to all your existing links... There is a script here that will do this for you automatically. Not doing this will make your admin mess up. Do the changes above, then add info manually to link #809 (your test), as a test. If it works OK, then go ahead and change all the others. What you need at the end of #809 is maybe the same thing that is now in position #2 (0|1|2|etc)... not sure.


Leonard
aka PerlFlunkie

Last edited by:

PerlFlunkie: Jun 16, 2003, 1:28 PM
Quote Reply
Re: [PerlFlunkie] Upload Mod In reply to
Hi Perlflunkie :)

Ok, i done the modifications that you said, its starting to do something cause this appears now..

http://www.stcd.sgnonline.com/...TEST_BANNER_UPLOADS/

The url to the attachement appears...but if you put the URL of a attachement in what comes up is a text file of the submitters email address...even though in the actual UPLOAD folder it's marked as a .jpg file. Maybe thats why the JPG banner isnt appearing, cause for some reason Links is converting that upload to a text file with the users email address but keeping it as a JPG.
Quote Reply
Re: [Katie Venra] Upload Mod In reply to
Ahhhhh....wait a minute :)

Ok, i moved the upload field to the bottom below the Email field, the link to the attachment now shows the piccie...

I'm going to try something in the template to make the attachment appear in the main links directory...hopefully the 'img' HTML tagging will work with this one...

*edit...

It's working!!

Thanks perlflunkie :)

Last edited by:

Katie Venra: Jun 16, 2003, 2:11 PM
Quote Reply
Re: [Katie Venra] Upload Mod In reply to
Looking at the page you linked, two of the four links have images, the other two are red-x'ed...

If you're still having problems, it's likely that the new field needs to be added to ALL links. Yes, it can be blank, but the pipe needs to be there.

**********

Looking good!

In your template, did you need <img src="<%Attach%>">?
Perhaps you could use an 'if' statement in link.html:

<%if Attach%>
<img src="<%Attach%>">
<%endif%>

or

<%if Attach%>
<a href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>"><img src="<%Attach%>"></a><%endif%>


Leonard
aka PerlFlunkie

Last edited by:

PerlFlunkie: Jun 16, 2003, 2:47 PM
Quote Reply
Re: [PerlFlunkie] Upload Mod In reply to
Yup...

To get it to work i had to move the attach file section of the add.html form to the bottom BELOW the contact email. For some strange reason if the attach file section is above the contact email, the database takes the contact email and turns the .jpg into the contact email address, then turns it into a .jpg even though it is still a .txt file.

Then once i moved the field to the bottom i encased it in the img src HTML field and it showed up :)

I'm all happy now :) thanks again perlflunkie :)