#!/usr/bin/perl # This is a basic script to interface with our # RJUPLD File Upload Pro client program. # You must leave the copyright information in this script. # The setup below is fairly simple. There is no read-me, all # help is below in the form of comments for each variable. # You will want to modify the sub routine -> Process_Upload # below for your specific purpose. This program is fully # functional and will write the uploaded files to a directory # specified in the $Save_Folder variable below. # To write to sub-directories of $Save_Folder, you can use # the returned variables. Also you can use the returned # variables for user authentication, or anything else # you may need. # This program can handle any type of file, from images and # HTML pages to executables. Configure the $RJ_UPLD_Allowed_File_Types # variable below to specify the types of files that are allowed. # There are 5 fields that are returned from the client upload. # 1. The uploaded file + File Name # 2. Auth_Key (this is a key that you specify to be returned, see below.) # 3. Field1 (this is a spare field you can use for anything) # 4. Field2 (this is a spare field you can use for anything) # 5. Sub_Folder (sub directoty to upload to) # Name the spare fields anything you need below. # The Auth_Key is returned with each upload for security. # In the free version only images can be uploaded and the file # size of the image must be less than 50K - gif, jpg, jpeg, png # Sub-Folders are not supported in free version # We also have a version that can automatically resize the images # when they reach the server. There are 3 options for sizes. # Origional image no matter what size, a medium size image and # a small image. # If you are using image resize, the program needs to append # the file name. # Example: for the Small size image you can use # $RJ_UPLD_Small = '90-s'; The '-s' will be apended to the # origional file name. Origional_name-s.jpg # YOU MUST USE THE DASH! NO OTHER CHARACTORS WILL WORK. # There are 2 options for how the client program is # accessed. Both use javascript. # If you want to use the option that prints the client program # using a full page (as in option 2 below) we can customize # that page for you with your logo and instructions for the # client. This requires that you buy an unlimited client license # that you will distribute to your customers. # If our standard build is used, we require your customer to # download the client program from our site. #~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~# # # Program is copyright by Ranson's Scripts all rights reserved # Email - support@rlaj.com # # Program Name ------- RJUPLD Upload Pro # Script Name -------- upload.pl # Program Version ---- 1.01 # Configuration File - None, see below. # # If FTP'ing this file, be sure to send in ASCII format # #~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~# ############################################################################################# ####################################### BEGIN SETUP ####################################### ############################################################################################# # for option 1 # Use the following script to start the upload process. # Place this script on your page where you want the # user to start the upload process. # # This is the preferred process. You decide how to access # this script that works best for you. # # # link: Upload Program # Folder all uploaded files will be written to # Must be complete path # For UNIX: must be set to 777 # DO NOT USE TRAILING SLASH $Save_Folder = '/usr/var/www/docs/bulkfileupload/uploads'; # For perl files, do you want the chmod them to 755 # May not work on all systems # Not necessary for Windows servers. # 1 = yes 0 = no $Chmod_Perl = '0'; # To set other files to 666 rw-rw-rw or ??? # 1 = yes 0 = no $Chmod_Others = '1'; # Setup an encryption key below for authentication # this can be any length and make it cryptic. # DO NOT USE DOLLAR SIGN, QUESTION MARK OR QUOTES, # OR A PIPE (|) Character. # Use numbers and mostly lower case letters. # Allowed Special Characters: ^ * ! [ ] ~ @ # % : $Auth_Key = 'rAy^*!4622retVvd[]~'; # There are 2 options for how the client program is # accessed. Both use javascript. # 1. Use the script above to access the upload.pl # This opens a window that resizes itself to # 320 X 600 the client program is placed in # this window. # 2. Accesses this script directly with browser. # This opens a file on the users machine # with an Iframe on the left that houses # the client program. $script_access = '2'; ### *** :) *** ### # Default folder to start in on users machine # Must be CAPITAL LETTER -> C:/ or D:/ etc. # Can alos be path -> C:/My+Documents/My+Pictures # Replace any spaces with + $RJ_UPLD_Default_Folder = 'C:/'; # Set the Allowed File Types Below # I = all image types. # H = HTML files only # IH = all images + HTML # A = all file types # A-E = all files except execuatables - exe, bat, etc. # A-E-S = no executables and no system files. # SP = specify file types. Use colon : between types # FORMAT -> SP<>gif:jpg:jpeg # In the free version, only images may be uploaded, # gif, jpg, jpeg, png $RJ_UPLD_Allowed_File_Types = 'IH'; # List all text files below $TextFiles = '.txt^.htm^.html'; # Upload Type - C = Multi-File-Uploads # R = Single-File-Upload $RJ_UPLD_Upload_Type = 'C'; # Set the Maxium size of the file that can be # Uploaded. for 50K - enter 50000 # Disabled in the free version and set to 50k $RJ_UPLD_Max_Size = '150000'; # If you want your user to be able to upload # files to their sub-directories, set the variable # to '1' below. 0 = no # This will find sub dirs to 3 levels deep # /userfolder/sub1/sub2/sub3 # All uploadable Folders must be set to chmod 777 # Not available in free version $RJ_UPLD_Allow_SUB_Dir = '1'; # If you only want your users to be able to upload # to certain sub-folders, enter them below # Use ^ between folders # Leave blank to auto-detect user sub-folders # Or comment out to auto-detect user sub-folders #$RJ_UPLD_SPECIFY_SUB_Dirs = 'images^html'; # Program to handle the upload on your server (this file?) $RJ_UPLD_Return = 'http://www.bulkfileupload.com/cgi-bin/rjupld-upload.pl'; # Enter web address for the style sheet $StyleSheet = 'http://www.bulkfileupload.com/style.css'; # Return Field1 Value $RJ_UPLD_Field1_Value = ''; # Return Field1 Name $RJ_UPLD_Field1_Name = 'day'; # Return Field2 Value $RJ_UPLD_Field2_Value = ''; # Return Field2 Name $RJ_UPLD_Field2_Name = 'caption'; ### *** :) *** ### # USING IMAGE RESIZE OPTION # Not available in free version # List all images allowed to be uploaded # Must use the dot # Put a colon (:) between file types $AllowedImages = ".gif:.jpg:.jpeg:.png"; # Specify Size of Small Returned Image # and the filename addition # Size is width^height # 90^90^s # 90 x 90 px - add -s to the filename # Leave blank or comment out for no resize $RJ_UPLD_Small = '90^90^-t'; # Specify Size of Meduim Returned Image # and the filename addition # Size is width^height # 200^200^m # 200 x 200 px - add -m to the filename # Leave blank or comment out for no resize $RJ_UPLD_Medium = '400^400^-m'; # If you want the origional size image uploaded # set the variable below to '1' 0 = no # Only applies of you are using resize above. $RJ_UPLD_Orig = '1'; ############################################################################################# ######################################## END SETUP ######################################## ############################################################################################# print "Content-type: text/html\n\n"; if ($ENV{'REQUEST_METHOD'} =~ /GET/i){ &Ready_Client(); } else { &Process_Upload(); } exit; ### *** :) *** ### # Do not change the javascript below. # Do not change the $RJ_UPLD_QS. sub Ready_Client { if ($RJ_UPLD_Allow_SUB_Dir eq "1" && $RJ_UPLD_SPECIFY_SUB_Dirs eq "") { &Find_Subs(); } if ($RJ_UPLD_Allow_SUB_Dir eq "1" && $RJ_UPLD_SPECIFY_SUB_Dirs ne "") { $folders = $RJ_UPLD_SPECIFY_SUB_Dirs; } &Build_QS(); if ($script_access eq "1") { $JS_Setup = qq! function Isonline() { setup = 1; var MyHeight = (window.screen.height) - 20; //window.resizeTo(625,MyHeight); document.write('


Please wait while page loads


'); document.write('
Click here if page fails to load
'); location.href = 'http://127.0.0.1:8080/%63%67%69-%62%69%6E/rjbfu.exe?$RJ_UPLD_QS'; } function OW() { window.open('http://127.0.0.1:8080/%63%67%69-%62%69%6E/rjbfu.exe?$RJ_UPLD_QS' , 'window', 'toolbar=no,scrollbars=yes,resizable=no,width=625,height=600,left=10,top=10') } !; }else{ $JS_Setup = qq! function Isonline() { var MyWidth = (window.screen.width) - 10; var MyHeight = (window.screen.height) - 80; setup = 1; //window.resizeTo(MyWidth,MyHeight); window.open('http://127.0.0.1:8080/%63%67%69-%62%69%6E/rjbfu.exe?$RJ_UPLD_QS' , 'window', 'toolbar=no,scrollbars=yes,resizable=no,width=625,height='+MyHeight+',left=5,top=5') } function OW() { var MyWidth = (window.screen.width) - 10; var MyHeight = (window.screen.height) - 80; window.open('http://127.0.0.1:8080/%63%67%69-%62%69%6E/rjbfu.exe?$RJ_UPLD_QS' , 'window', 'toolbar=no,scrollbars=yes,resizable=no,width=625,height='+MyHeight+',left=5,top=5') //new popUp(0, 0, 625, 700, "Div1", "http://127.0.0.1:8080/cgi-bin/rjbfu.exe?$RJ_UPLD_QS", "white", "#00385c", "16pt serif", "RJUPLD File Upload Pro", "#00385c", "white", "lightgrey", "#00568c", "black", true, true, true, true, true, false,'http://bulkfileupload.com/images/min.gif','http://bulkfileupload.com/images/max.gif','http://bulkfileupload.com/images/close.gif','http://bulkfileupload.com/images/resize.gif'); } !; } print qq| RJ_UPLD Client Setup

RJUPLD File Upload Pro


The client program, RJUPLD, is not running. Please start the program on your computer.
To start the program, Click Start -> Programs -> Startup -> RJUPLD

if you have not downloaded the client upload program, RJ_UPLD_Install.exe please download and install it now.

http://www.rlaj.com/RJ_UPLD/RJ_UPLD_Install.exe

if you browser blocks popups, click here to start upload.






Note: if you see a window that says 'connection refused' then your client is not running and you need to start the RJUPLD on your computer.
|; } ### *** :) *** ### sub Process_Upload { use CGI qw(:standard); $| = 1; binmode(STDIN); binmode(STDOUT); binmode(STDERR); $query = new CGI; $filename = $query->param("FILENAME"); $file = $query->param("FILE"); # DO NOT CHANGE THE $AuthKey BELOW $AuthKey = $query->param("AuthKey"); $AuthKey =~ tr/9102837465/0-9/; $AuthKey =~ tr/badzcknmqfehgjilorvuxptswy/abcdefghijklmnopqrstuvwxyz/; # These 2 values are the return values for the 2 additional fields. $Field1_Value = $query->param("$RJ_UPLD_Field1_Name"); $Field2_Value = $query->param("$RJ_UPLD_Field2_Name"); # sub folder to upload to $Sub_Folder = $query->param("SubFolder"); # DO NOT CHANGE THE WORDING IN AuthKey BELOW. if ($AuthKey ne "$Auth_Key") { print "

Upload Failed, Door Locked - Bad Key"; exit;} if ($RJ_UPLD_Allow_SUB_Dir eq "1" && $Sub_Folder ne "") { $Save_Folder .= "/$Sub_Folder"; } $ext = $filename; $ext =~ s/.*(\.\w+)/$1/; $bytesread=0; print $filename; open (OUTFILE, ">$Save_Folder/$filename"); if ($TextFiles !~ /$ext/) { binmode OUTFILE; } while ($bytesread = read($file, $buffer, 2048)) { if ($TextFiles =~ /$ext/) { $buffer =~ s/\cM//g; } print OUTFILE $buffer; } close (OUTFILE); if (($filename =~ /\.pl/ || $filename =~ /\.cgi/)&& $Chmod_Perl eq "1") { chmod (0755, "$Save_Folder/$filename"); } elsif (($filename !~ /\.pl/ || $filename !~ /\.cgi/)&& $Chmod_Others eq "1") { chmod (0666, "$Save_Folder/$filename"); } if (-e "$Save_Folder/$filename") { print " Success"; } else{ print " Upload Failed $Save_Folder/$filename"; } exit; } ### *** :) *** ### # DO NOT EDIT BELOW! sub Build_QS { $RJ_UPLD_QS = qq($RJ_UPLD_Default_Folder&$RJ_UPLD_Allowed_File_Types&$RJ_UPLD_Upload_Type&S&$RJ_UPLD_Return&$RJ_UPLD_Field1_Value&$RJ_UPLD_Field1_Name&$RJ_UPLD_Field2_Value&$RJ_UPLD_Field2_Name&$RJ_UPLD_Small&$RJ_UPLD_Medium&$RJ_UPLD_Orig&$RJ_UPLD_Max_Size&$Auth_Key&$script_access&$RJ_UPLD_Allow_SUB_Dir&$AllowedImages&$StyleSheet&$folders);$RJ_UPLD_QS =~ tr/0-9/9102837465/;$RJ_UPLD_QS =~ tr/abcdefghijklmnopqrstuvwxyz/badzcknmqfehgjilorvuxptswy/; } sub Find_Subs { opendir(DATADIR, "$Save_Folder"); @DIRS = grep (!/^\.\.?$/, readdir (DATADIR)); closedir(DATADIR); foreach $DIR(sort(@DIRS)) { $Dir2 = ""; if (-d "$Save_Folder/$DIR") { $folders .= "$DIR^"; $Dir2 = "$Save_Folder/$DIR"; &Get_Subs2(); } } } # End Sub sub Get_Subs2 { opendir(DATADIR, "$Dir2"); @DIRS2 = grep (!/^\.\.?$/, readdir (DATADIR)); closedir(DATADIR); foreach $DIR2(sort(@DIRS2)) { if (-d "$Save_Folder/$DIR/$DIR2") { $folders .= "$DIR/$DIR2^"; $Dir3 = "$Save_Folder/$DIR/$DIR2"; &Get_Subs3(); } } } # End Sub sub Get_Subs3 { opendir(DATADIR, "$Dir3"); @DIRS3 = grep (!/^\.\.?$/, readdir (DATADIR)); closedir(DATADIR); foreach $DIR3(sort(@DIRS3)) { if (-d "$Save_Folder/$DIR/$DIR2/$DIR3") { $folders .= "$DIR/$DIR2/$DIR3^"; } } } # End Sub ### *** :) *** ### __END__ # Test code not used if ($TextFiles =~ /$ext_NO/) { open (TXTFILE, "$Save_Folder/$filename"); @TXTFILE = ; close(TXTFILE); foreach $Line(@TXTFILE) { $Line =~ s/\cM//g; $NewLines .= $Line; } open (OUTFILE2, ">$Save_Folder/$filename"); print OUTFILE2 $NewLines; close (OUTFILE2); }