Gossamer Forum
Home : Products : Links 2.0 : Customization :

File Uploader/Downloader

Quote Reply
File Uploader/Downloader
Just to let you know, I am working on a new mod for links2 which is a file upload mod with a difference.

Your visitors either have the option to upload a file from their hard-drive to the server, which will be dynamically renamed to the sites title so the file names don't clash. Secondly, if the visitor has the file on their server rather than their hard-drive then the script will go and download it automatically and again rename it for local storage.

It can also send submitted files to the webmaster if required.

You will need to add something like this to links.cfg for the files to be downloaded in search results....

<%build_root_url%>/files/<%site_title%>.(gif|jpg|zip) etc.....

Oh yes...you can also allow only certain file types and limit the upload size.

Please let me know if this sounds useful.

I originally made it as a standalone cgi-script for someone but it can be easily ported into Links2 so shouldn't take long....

Here is a demo...

http://www.perlmad.com/test/ace.cgi

Thanks.

Paul Wilson.
Installations:
http://www.wiredon.net/gt/
Quote Reply
Re: File Uploader/Downloader In reply to
While I don't anticipate a need for this MOD for myself, as you well know from reading this forum, this MOD is often in demand.

I'm sure it will be appropriately appreciated by all who need it.

It certainly looked good...

Gene
Quote Reply
Re: File Uploader/Downloader In reply to
Paul, I think this mod would be a nice addition to the current available mods.


Because this mod wan't available months ago I wrote a simular mod myself. (Only upload, rename to ID.extension and hyperlink in adminscreen. Nothing special but it does what I need.) The only feature I didn't succeed in writing was the "mail attachment to admin". Because (like you write before Wink) I was too concerned about speed. The user already needs to wait for a long time for the file to be uploaded and I thought (=past) that processing the uploaded file for mailing would take even more time. But now I think the new Mailer.pm of GTMail could handle this very nicely.

So, yes I'm interested in this mod for the "mail attachment to admin" feature. Wink And if you need my mod; just mail me!




Quote Reply
Re: File Uploader/Downloader In reply to
well how safe it is?? can hackers use it for fun?

Quote Reply
Re: File Uploader/Downloader In reply to
Of course not.

You can specify which file types are allowed and the size limit.

Therefore if you leave things like - exe bat com vbs, out of the allowed extension list then a hacker can't execute any virus like code.


Paul Wilson.
Installations:
http://www.wiredon.net/gt/
Quote Reply
Re: File Uploader/Downloader In reply to
Thanks chrishintz,

I can give you the code for emailing the file to admin now if you want....it is fairly simple.

Shall I post it here for everyone?

Paul Wilson.
Installations:
http://www.wiredon.net/gt/
Quote Reply
Re: File Uploader/Downloader In reply to
Did you receive my file upload my_version.cgi.zip? (just a txt file actaully) Maybe the 2 lines with "known bug's" could be handy for your "readme.txt" because the are not real bugs but limitations Smile

...and about the code: Please; and I assume that indeed mailing the attachment to the admin doen't result in more waintingtime for the user because the file is already on the server.




Quote Reply
Re: File Uploader/Downloader In reply to
Hi I will check my emails.....

Yes you are right....the file is already on the server when it is email so in effect it happens in the background - users will notice no difference...

Let me find the email you sent me so I can post the code....

Paul Wilson.
Installations:
http://www.wiredon.net/gt/
Quote Reply
Re: File Uploader/Downloader In reply to
Offcourse I used your upload script Wink



Quote Reply
Re: File Uploader/Downloader In reply to
Oh pants - you may want to send it normally as that test sends the emails somewhere else.....ooops.

Paul Wilson.
Installations:
http://www.wiredon.net/gt/
Quote Reply
Re: File Uploader/Downloader In reply to
Paul,

This sounds great. I originally posted the File upload mod by Phoenix after searching and collecting files and information from the forum. It works ok but has its obvious limitation.

I am very interested in a mod that can modify and delete files included with the link. Will that be part of the current mod you are working on.
I am using it as a lecture/presentation directory and this feature would be extremely useful.
Christian



Quote Reply
Re: File Uploader/Downloader In reply to
Looks like a great mod, I look forward to using it on my site!!



Until next time...

Ryan

http://links.innovationstudios.com/
Quote Reply
Re: File Uploader/Downloader In reply to
Well, I'm one of the few that got Phenoix's mod to work right, but looking at what this does I'll probably switch over to it, I'm looking forward to it and I know a lot of other people are.

YellowKard
Quote Reply
Re: File Uploader/Downloader In reply to
Just to keep you updated, I've been busy recently so haven't done much on the mod but it should be complete within a day or two unless I run into problems....

Paul Wilson.
Installations:
http://www.wiredon.net/gt/
Quote Reply
Re: File Uploader/Downloader In reply to
Where could I get this mod? I followed the link on your post but I couldn't find anything.

Thanks again,
- Edy Budiman

Quote Reply
Re: File Uploader/Downloader In reply to
The link was a demo - the proper mod is not finished yet and will not be free.

Paul Wilson.
Installations:
http://www.wiredon.net/gt/
Quote Reply
Re: File Uploader/Downloader In reply to
Woahh...

I take it this will be the first non open source mod for Links?

I have to say, theres no reason for me to switch then since I already have Phenoix's mod.

YellowKard
Quote Reply
Re: File Uploader/Downloader In reply to
Uh...no, there are many other paid modifications, including:

1) Comments4 - glennu
2) MyLinks - jerry su
3) Review.cgi - jerry su

And if you notice the trends in LINKS SQL, paid plug-ins are also being developed....

Might want to spend more time reading threads...

Regards,

Eliot Lee
Quote Reply
Re: File Uploader/Downloader In reply to
In Reply To:
Thanks chrishintz,

I can give you the code for emailing the file to admin now if you want....it is fairly simple.

Shall I post it here for everyone?
Yes, that would be nice!

(I assume you read my email, Paul Wink)

Quote Reply
Re: File Uploader/Downloader In reply to
Ok ok sorry.........I've been busy Smile

Code:
my @boundaryv = (0..9, 'A'..'F');
srand(time ^ $$);
for (my $i = 0; $i++ < 24;) {
$boundary .= $boundaryv[rand(@boundaryv)];
}
my $mail = "/usr/sbin/sendmail -t -i";
open(MAIL,"|$mail");
print MAIL "To: $email\n";
print MAIL "From: $return_email\n";
print MAIL "Subject: Bla!\n";
print MAIL "Content-Type: multipart/mixed; boundary=\"------------$boundary\"\n";
print MAIL "\n";
print MAIL "This is a multi-part message in MIME format.\n";
print MAIL "--------------$boundary\n";
print MAIL "Content-Type: text/plain; charset=us-ascii\n";
print MAIL "Content-Transfer-Encoding: 7bit\n\n";
print MAIL "Message\n\n";
print MAIL "\n";
print MAIL "--------------$boundary\n";
print MAIL "Content-Type: application/octet-stream; name=\"$file_name\"\n";
print MAIL "Content-Transfer-Encoding: base64\n";
print MAIL "Content-Disposition: inline; filename=\"$file_name\"\n\n";
my $buf;
$/=0;
open INPUT, "$file_name";
binmode INPUT if ($^O eq 'NT' or $^O eq 'MSWin32');
while(read(INPUT, $buf, 60*57)) {
print MAIL &encode_base64($buf);
}
close INPUT;
print MAIL "\n--------------$boundary--\n";
print MAIL "\n";
close MAIL;
All the bits in red are what you will have to adapt for your own use. Also add this to the top of add.cgi......

use MIME::Base64 qw(encode_base64);





Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: File Uploader/Downloader In reply to
Thanks Paul,

I'm alsow really busy this week; so I'll try to implement this cool feature next week.

Chris