################################################################### # Upload It - File Upload Script Version 1.2 # # Copyright (©)2000 Marek A Molozzi, All Rights Reserved. # # Duplicating or redistributing this program without prior # written consent is expressly forbidden. You must Obtain # permission before redistributing this software by any means. # In all cases this copyright/license notice must remain intact. # # http://Marek'sScripts.w2w.cc/ # # Last Modified 6/18/2000 ################################################################### Copyright ==================== Duplicating or redistributing this program without prior written consent is expressly forbidden. You must Obtain permission before redistributing this software by any means. In all cases the copyright/license notice must remain intact. Description ==================== Upload It makes it quick and easy for visitors or clients to send you files by uploading them to your web site. Features include the ability to optionally restrict file types, email the webmaster with a list of uploaded files, and or create a log file listing uploaded files. For security reasons the location of all uploaded files is kept hidden (It can even be on a different server!). This script is ideal for adult webmasters or any one else who wants to allow visitors to be able to easily upload content. Features ==================== - Makes it quick and easy for visitors or clients to send you files. - Optionally restrict file types by extension (e.g. .jpg). - Optionally email the webmaster each time files are uploaded. - Optionally keep a log file listing all uploads. - Hides the location of uploaded files from visitors. Requirements ==================== - Perl 5 - Unix Based Web Server - cgi capability - Sendmail (optional) Installation Steps ==================== A. Edit the first line of the main script from #!/usr/bin/perl to the required Perl path specified on your server. (If you don't know contact somebody who does, such as a web host's technical support. Commonly it can be /usr/bin/perl, /usr/sbin/perl, /usr/local/perl, etc...) B. Modify the variables in the up.cgi (open it using notepad and scroll down until you see the line "Define Variables"). 1. $imagedir = "/home/yourdomain/www/upfiles"; ==================================================================== The full path to the directory where you wish to store the uploaded files. Do not include the trailing slash. 2. $log = "/home/yourdomain/www/cgi-bin/up.log"; ==================================================================== The full path to the location of your log file (up.log) including the file name. The default file name is "up.log". 3. $numfiles = "5"; ==================================================================== The number of files you want to have uploaded at one time. Set this equal to the number of files fields on your up.html (see Installation Step B. below). 4. @referers = ('yourdomain.com', www.yourdomain.com', '209.456.66.132'); ==================================================================== The referrers list is the list of domains and IP addresses that are allowed access the script. Use it to prevent others from accessing the program from another server. Replace yourdomain.com and the IP numbers to match your site (case insensitive). You can add as many as you like. @referers = ('yourdomain.com','another.com','another2.com'); @referers = ('yourdomain.com'); As you can see each item should be in single quotes and seperated by a comma (unless there is only 1 item, then no comma is required) 5. $allowall = "no"; ==================================================================== Set this variable to allow all file ("yes") types to be uploaded or to restrict file types ("no"). Use lower case yes/no only. 6. @filetypes = ('.jpg', '.jpeg', '.gif'); ==================================================================== The file types list is the list of file type extensions you wish to allow visitors to be able to upload. Use it to prevent visitors from uploading unwanted file types. You can add as many as you like (case insensitive). Graphic Files Only: @filetypes = ('.jpg', '.jpeg', '.gif',); text/html Files Only: @filetypes = ('.txt', '.htm', '.html'); Zip Files Only: @filetypes = ('.zip'); As you can see each item should be in single quotes and seperated by a comma (unless there is only 1 item, then no comma is required) 7. $EMail = "yes"; ==================================================================== Here you have two choices "yes" and "no". If you want to be emailed each time files are uploaded select "yes", otherwise select "no". Note: "yes" and "no" must be in lower case. "YES" and "NO" will not work. 8. $sendmail="/usr/bin/sendmail"; ==================================================================== Enter the full path to sendmail on your server (If you don't know contact somebody who does, such as a web host's technical support. Commonly it can be /usr/lib/sendmail, /usr/sbin/sendmail, /usr/bin/sendmail, etc...). 9. $ConfirmToEmail = "youremail\@yourdomain.com"; ==================================================================== Your email address. Make sure you include the "\" before the @ symbol. If you don't it will cause the script to crash. 10. $subject = "Files Uploaded"; ==================================================================== Enter the subject of the email notification. 11. Results Page Background and Coulour Options (Optional) ==================================================================== Use the following variables to customize the look and feel of the results page to match the rest of your site: Background Colour: $bgcolor = "#FFFFFF"; Text Colour: $text = "#000000"; Link Colour: $link = "#0000FF"; Visited Link Colour: $vlink = "#800080"; Background Image: $background = ""; # (e.g. "abc.gif") 12. Results Page Text Options (Optional) ==================================================================== Use the following variables to customize the results page text: Page Title: $html_title="Thank You!"; Page Header 1: $html_header="Thank You!"; Page Header 2: $html_header2="Files Uploaded"; Message: $message = "Thank you for uploading."; 13. Results Page Link Options ==================================================================== Use the following variables to customize the results page Links: Link 1 URL: $link1 = "http://www.yourdomain.com/index.html"; Link 1 Text: $text_link1 = "Home"; Link 2 URL: $link2 = "http://www.yourdomain.com/links.html"; Link 2 Text: $text_link2 = "Links"; Link 3 URL: $link3 = "http://www.yourdomain.com/up.html"; Link 3 Text: $text_link3 = "Back"; C. Modify the up.html (open it using notepad and scroll down until you see the line "