#!/usr/bin/perl # #Make sure that the above line is at the very first line, not #several lines down, and that it is completely flush with #the left margin, or your script will not work. #(c)FLATTEXT Database Scripts 1997-2001 use CGI; $query = new CGI; #You need to modify this script at all parts of Step B #Depending on where Perl is on your server, the above location #may not be correct. To find where Perl is, telnet to your #server and at the prompt type: which perl This will tell you #the correct path to Perl on your server. Or, contact your #server administrator #Script Description #Unique script ID: ftx398-59f6 #Created on: 12/12/2001 #Last edited on: 12/13/2001 #Script class: B #You can edit this script on our server any time up to 365 days #after it was first created or last edited. The values that you used #to create this script will be loaded and you can change the #configurations as needed. Any edits you make to this script offline #should be marked with comments so that you can easily find them and #transfer them to any upgraded scripts you create #See http://flattext.com #STEP A================================ #SCRIPT USAGE #This is FLATTEXT 6.0, released November 1, 2000 #COPYRIGHT NOTICE #FLATTEXT License for Regular Scripts #All FLATTEXT scripts are copyright (c) FLATTEXT Database #Scripts 1997-2001. Legally, you must retain the copyright #line inside the script. You are free to remove the printed #"Search results by FLATTEXT" text that appears inside Step #L of your script (see instructions inside script), but #under no circumstances should the copyright assignment #line be removed near the top of the script itself. #Each script is licensed for use on a single computer or #server. Running multiple versions of the same script, or #continually editing the same script for different uses is #not permitted. Each implementation of the script requires #a new license (exceptions to this are unlimited Developer #accounts created prior to October 2001 and those who have #made separate and written arrangements with us). #By using any of our scripts, you agree not to hold us #liable for any lost data, time, or any other costs #directly or indirectly associated with the use of our product. #We are more than happy to help you if you experience #any difficulties with this script. Many of the most #common problems are addressed in the help #files at: #http://flattext.com/help/ #A1. The following lines get and process data passed #through the URL, do not modify $stringpassed=$ENV{'QUERY_STRING'}; #A2. Replace all plusses with spaces for data passed via URL $stringpassed=~s/\+/ /g; #STEP B================================ #You MUST modify each of the variables in this this section #B1. REQUIRED: The location of data file on your server. This must #be the PATH to your data file, not the URL of your data file! There #is extensive treatment of this in the Help Pages, under Data File #Errors: http://flattext.com/help/ $data="/mnt/web/guide/server63/www/kokopelli/products/artist.data"; #B2. REQUIRED: The URL of this file in your cgi-bin directory. You must #provide the full URL, beginning with http $thisurl="http://server63.com/kokopelli/products/artist.cgi"; #B3. OPTIONAL: You can format the opening and closing HTML #of your results page in a separate file that can be written in #regular HTML and saved on your server. If your script can't #find this file and open it, the default result screen is displayed #instead. For ease of configuration, place it in the same directory #as your data file. Note: this file must have three plusses +++ #where you want your search results inserted. See help file #under Template Problems: http://flattext.com/help/ $openinghtml="/mnt/web/guide/server63/www/kokopelli/pages/results-artists.shtml"; #B4. REQUIRED TO ADD, DELETE, OR MODIFY. See #important information in the help files about adding additional #Security features to your script. #Change password to any combination of letters (A-Z, a-z) and #numbers 0-1. USE ONLY LETTERS AND NUMBERS $adminpassword="koko"; #B5. URL to send users to after posting, editing, or getting errors. #This is usually the main page for this section of your site $forwardingURL="http://server63.com/kokopelli/edit/artist.html"; #B18. Please provide the path to the directory where #your upload images will go. You need to make sure that you #chmod 766 this directory, to make it writeable by your script. #The path you are providing below should end with a forwardslash. #This feature is inherently INSECURE and opens a wide range of #SECURITY issues, many of them very serious. You are highly encouraged #to direct all uploads to a nonpublic directory and then move them #to a public directory only after you have evaluated the files. #Use at your own risk. $Imageuploadpath="/mnt/web/guide/server63/www/kokopelli/preview/"; #B19. Please provide the URL to the directory where your #your uploaded images will be located. Note that this must be a #full URL beginning with http:// for the directory only! Forwardslash #at end of the URL is required $ImageuploadURL="http://server63.com/kokopelli/preview/"; #B20. Please specify the largest file for the image upload #that you are willing to permit. This value is in KB, so use numbers #like 50 for 50KB. Never set the number above 100 $Imagemaxz="75"; #STEP C================================ #C1. Maximum number of matching records to display per page $maximumpage=25; #C2. Maximum total number of records to display per search, #for stylistic reasons, should be multiple of above number $maximum=250; #STEP D================================ #You should not need to modify this section at all #D1. Check to see if opening html file is on server if (-e "$openinghtml"){ #D2. If so, open it and write opening and closing text to different strings #to be used throughout the script $problem="Can't open template file. Make sure you are referencing the file and not just a directory."; open(OPENING, "$openinghtml") || &security; @wholefile=; close(OPENING); $fulltemplate=join("\n",@wholefile); ($templatestart,$templateend)=split(/\+\+\+/,$fulltemplate);} else{ #D3. If template file not found, use this for now $templatestart="$templatetitle"; $templateend="";} $delimiter="\t"; #D6. Get Password Entered by User $checkpassword=$query->param('checkpassword'); #D7. Figure out what action user wants to take. $actiontotake=$query->param('actiontotake'); $linenumberpass=$query->param('linenumberpass'); #D8. If user wants to delete record, and has already #verified password, then go to the makechange subroutine if ($actiontotake eq "Delete Record"){ $recordaction="Deleted"; &makechange; exit;} #D9. If user wants to edit record, and has already #verified password, then go to the makechange subroutine if ($actiontotake eq "Edit Record"){ $recordaction="Edited"; &makechange; exit;} #D10. If user wants to edit record, to go subroutine to verify if ($actiontotake eq "Edit"){ &edit; exit;} #D11. If user wants to delete record, to go subroutine to verify if ($actiontotake eq "Delete"){ &delete; exit;} #D12. If user wants to add record, go to add subroutine if ($actiontotake eq "Add"){ &addrecord; exit;} #STEP E================================ #E1. Get the data passed from user $Medium=$query->param('Medium'); $Mediumwork=lc($Medium); if ($Mediumwork eq "select"){ $Mediumwork=""; $Medium="";} $Mediumpass="$Medium"; #E1. Get the data passed from user $Artist=$query->param('Artist'); $Artistwork=lc($Artist); if ($Artistwork eq "select"){ $Artistwork=""; $Artist="";} $Artistpass="$Artist"; #E1. Get the data passed from user $Residence=$query->param('Residence'); $Residencework=lc($Residence); if ($Residencework eq "select"){ $Residencework=""; $Residence="";} $Residencepass="$Residence"; #E1. Get the data passed from user $Description=$query->param('Description'); $Descriptionwork=lc($Description); if ($Descriptionwork eq "select"){ $Descriptionwork=""; $Description="";} $Descriptionpass="$Description"; #E1. Get the data passed from user $Search=$query->param('Search'); $Searchwork=lc($Search); if ($Searchwork eq "select"){ $Searchwork=""; $Search="";} $Searchpass="$Search"; #E6. Get number of records already displayed $startitem=$query->param('startitem'); #E7. Figure the last record to display on this page $enditem=$startitem+$maximumpage; #F4a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$Mediumwork=~tr/[]/e/; #$Mediumwork=~tr/[]/a/; #$Mediumwork=~tr/[]/c/; #$Mediumwork=~tr/[Ց]/i/; #$Mediumwork=~tr/[ٞ]/o/; #$Mediumwork=~tr/[И]/u/; ($Mediumone, $Mediumtwo, $Mediumthree, $Mediumfour, $Mediumfive, $Mediumsix, $Mediumseven)=split(/ /, $Mediumwork); #F4a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$Artistwork=~tr/[]/e/; #$Artistwork=~tr/[]/a/; #$Artistwork=~tr/[]/c/; #$Artistwork=~tr/[Ց]/i/; #$Artistwork=~tr/[ٞ]/o/; #$Artistwork=~tr/[И]/u/; ($Artistone, $Artisttwo, $Artistthree, $Artistfour, $Artistfive, $Artistsix, $Artistseven)=split(/ /, $Artistwork); #F4a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$Residencework=~tr/[]/e/; #$Residencework=~tr/[]/a/; #$Residencework=~tr/[]/c/; #$Residencework=~tr/[Ց]/i/; #$Residencework=~tr/[ٞ]/o/; #$Residencework=~tr/[И]/u/; ($Residenceone, $Residencetwo, $Residencethree, $Residencefour, $Residencefive, $Residencesix, $Residenceseven)=split(/ /, $Residencework); #F4a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$Descriptionwork=~tr/[]/e/; #$Descriptionwork=~tr/[]/a/; #$Descriptionwork=~tr/[]/c/; #$Descriptionwork=~tr/[Ց]/i/; #$Descriptionwork=~tr/[ٞ]/o/; #$Descriptionwork=~tr/[И]/u/; ($Descriptionone, $Descriptiontwo, $Descriptionthree, $Descriptionfour, $Descriptionfive, $Descriptionsix, $Descriptionseven)=split(/ /, $Descriptionwork); #F4a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$Searchwork=~tr/[]/e/; #$Searchwork=~tr/[]/a/; #$Searchwork=~tr/[]/c/; #$Searchwork=~tr/[Ց]/i/; #$Searchwork=~tr/[ٞ]/o/; #$Searchwork=~tr/[И]/u/; ($Searchone, $Searchtwo, $Searchthree, $Searchfour, $Searchfive, $Searchsix, $Searchseven)=split(/ /, $Searchwork); #STEP G================================ #Do not modify this section #G1. Open datafile and write contents to an array, if can't open report the problem at the security subroutine $problem="You do not have a file to search on the server. Please ADD test records before trying to search your test data file."; open (FILE, "$data") || &security; @all=; close (FILE); #G2. The line below is required, do not modify print "Content-type: text/html\n\n"; #G3. Display HTML Header print "$templatestart\n"; #G5. Show words user searched for print "You Searched For: \n"; if ($Medium){ print "Medium\=$Medium\n";} if ($Artist){ print "Artist\=$Artist\n";} if ($Residence){ print "Residence\=$Residence\n";} if ($Description){ print "Description\=$Description\n";} if ($Search){ print "Search\=$Search\n";} #STEP H================================ #H1. Read each line of the data file, compare with search words foreach $line (@all){ $line=~s/\n//g; $loopsaround++; $checkleng=length($line); if ($checkleng<2){next}; $linetemp1=lc($line); #H1a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$linetemp1=~tr/[]/e/; #$linetemp1=~tr/[]/a/; #$linetemp1=~tr/[]/c/; #$linetemp1=~tr/[Ց]/i/; #$linetemp1=~tr/[ٞ]/o/; #$linetemp1=~tr/[И]/u/; ($Medium,$Image_Upload,$Artist,$Residence,$Description,$Search,$skipthisfield)=split (/$delimiter/,$linetemp1); #H9. This line specifies the fields to sort results by #See help databases for patches to allow various kinds of sorts $line="$Medium$Residence$Artist$delimiter$loopsaround$delimiter$line"; #H9.5 This line removes stray leading spaces before sorting your results $line=~s/^ +//; $increcount=0; #H12. Look for matches in field named Medium if (($Medium =~/\b$Mediumone/ && $Medium =~/\b$Mediumtwo/ && $Medium =~/\b$Mediumthree/ && $Medium =~/\b$Mediumfour/ && $Medium =~/\b$Mediumfive/ && $Medium=~/\b$Mediumsix/ && $Medium=~/\b$Mediumseven/) || !$Mediumwork) { $increcount++;} #H12. Look for matches in field named Artist if (($Artist =~/\b$Artistone/ && $Artist =~/\b$Artisttwo/ && $Artist =~/\b$Artistthree/ && $Artist =~/\b$Artistfour/ && $Artist =~/\b$Artistfive/ && $Artist=~/\b$Artistsix/ && $Artist=~/\b$Artistseven/) || !$Artistwork) { $increcount++;} #H12. Look for matches in field named Residence if (($Residence =~/\b$Residenceone/ && $Residence =~/\b$Residencetwo/ && $Residence =~/\b$Residencethree/ && $Residence =~/\b$Residencefour/ && $Residence =~/\b$Residencefive/ && $Residence=~/\b$Residencesix/ && $Residence=~/\b$Residenceseven/) || !$Residencework) { $increcount++;} #H12. Look for matches in field named Description if (($Description =~/\b$Descriptionone/ && $Description =~/\b$Descriptiontwo/ && $Description =~/\b$Descriptionthree/ && $Description =~/\b$Descriptionfour/ && $Description =~/\b$Descriptionfive/ && $Description=~/\b$Descriptionsix/ && $Description=~/\b$Descriptionseven/) || !$Descriptionwork) { $increcount++;} #H12. Look for matches in field named Search if (($Search =~/\b$Searchone/ && $Search =~/\b$Searchtwo/ && $Search =~/\b$Searchthree/ && $Search =~/\b$Searchfour/ && $Search =~/\b$Searchfive/ && $Search=~/\b$Searchsix/ && $Search=~/\b$Searchseven/) || !$Searchwork) { $increcount++;} if ($increcount==5){ push (@keepers,$line);}} #STEP J================================ #J1. Sort matches stored in array. @keepers=sort(@keepers); #J2. Get and display number of matches found $length1=@keepers; #J3. If the number of matches is less than enditem, adjust if ($length1<$enditem){ $enditem=$length1; $displaystat="Y";} #J4. The first field about to display $disstart=$startitem+1; #J5. Show user total number of matches found if ($length1){ print "$length1 Matches Found (displaying $disstart to $enditem)

\n"; } else { print "Your search found zero records, please try again.

\n";} #STEP K================================ #K1. Do some HTML formatting before showing results #K4. Keep track of results processed on this page foreach $line (@keepers){ #K5. Delete stray hard returns $line=~s/\n//g; #K6. Keep track of records displayed $countline1++; #K7. Decide whether or not this record goes on this page if ($countline1>$startitem && $countline1<=$enditem){ #K8. Open each line of sorted array for displaying ($sortfield,$loopsaround,$Medium,$Image_Upload,$Artist,$Residence,$Description,$Search,$skipthisfield)=split (/$delimiter/,$line); print "\n"; #K15. Formatting for field Medium. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Medium){ print "$Medium
\n";} #K15. Formatting for field Image_Upload. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Image_Upload){ print "\n";} #K15. Formatting for field Artist. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Artist){ print "$Artist: \n";} #K15. Formatting for field Residence. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Residence){ print "($Residence) \n";} #K15. Formatting for field Description. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Description){ print "$Description
\n";} #K15. Formatting for field Search. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Search){ print "Search for this artist
\n";} print "



\n"; #K9. Check passwords before showing edit and delete buttons if ($adminpassword eq $checkpassword){ print "
\n";} #STEP L================================ #L1. If total displayed equals maximum you set, then exit if ($countline1 == $maximum && $maximum){ $problem2="Your search was terminated at $maximum records, please be more specific in your search"; last;} #L2. If script just got to last match then exit program if ($length1 == $countline1){ last;} #L3. If script is at the end of a page then show NEXT button if ($countline1 == $enditem && $displaystat ne "Y" && $maximum>$countline1){ $stopit="Y"; last; } }} #L4. Display NEXT MATCHES button if ($stopit eq "Y"){ print "
\n"; #L5. Pass hidden variables so script will know how to display next page print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print "
\n"; } #L6. Show problems print "

$problem2\n"; #L7. Show credits. If registered, you can delete entire Step L7 #print "

Search Results by FLATTEXT
\n"; #L8. If opening.htm was found, show its closing html codes srand(); $checkval=int(rand(30)); if ($checkval==3){ print "\n";} print "$templateend\n"; exit; #STEP M================================ sub security{ #M1. This is the subroutine that reports all problems print "Content-type: text/html\n\n"; print "$templatestart\n"; print "
Data Error

\n"; print "Please correct the following error:

$problem
\n"; print "$templateend\n"; exit; } #STEP N================================ sub edit{ #N1. Open data file and read it $problem="Can't open data file to read from it at edit subroutine"; open (FILE,"$data") || &security; @all=; close (FILE); #N2. Read each line of the data file foreach $line (@all){ $line=~s/\n//g; ($copyMedium,$copyImage_Upload,$copyArtist,$copyResidence,$copyDescription,$copySearch,$skipthisfield)=split (/$delimiter/,$line); $keepcount++; #N3. Find the line user wants to modify if ($keepcount==$linenumberpass){ $linetokeep=$line; $linetokeep=~s/markedtoedit//g; last; } } #N4. Check password sent via hidden field if ($adminpassword ne $checkpassword){ $problem="Your password does not match the master password and appears to have been changed since logging onto this record."; &security;} #N6. Split matching line into its respective variables ($Medium,$Image_Upload,$Artist,$Residence,$Description,$Search,$skipthisfield)=split (/$delimiter/,$linetokeep); #Required Header, do not delete print "Content-type: text/html\n\n"; #N8. If can't find opening html, display default header print "$templatestart\n"; print "

Edit this Record

\n"; print "

\n"; print "\n"; print "\n"; print "\n"; print "\n"; $Description=~s/
/\n/g; $Description=~s/
/\n/g; print "\n"; print "\n"; #N10. Pass values to next screen print "
Medium:
Image Upload:
Artist:
Residence:
Description:
Search:
\n"; print "\n"; print "\n"; print "

\n"; print "$templateend\n"; exit; } #STEP O================================ sub delete{ #O1. Open data file and read it $problem="Can't open data file to read from it at delete subroutine"; open (FILE,"$data") || &security; @all=; close (FILE); #O2. Read each line of the file foreach $line (@all){ $line=~s/\n//g; ($copyMedium,$copyImage_Upload,$copyArtist,$copyResidence,$copyDescription,$copySearch,$skipthisfield)=split (/$delimiter/,$line); $keepcount++; #O3. Find line to delete if ($keepcount==$linenumberpass){ $linetokeep=$line; $linetokeep=~s/markedtoedit//g; last; } } ($Medium,$Image_Upload,$Artist,$Residence,$Description,$Search,$skipthisfield)=split (/$delimiter/,$linetokeep); #O4. Check password sent via hidden field if ($adminpassword ne $checkpassword){ $problem="Your password does not match the master password."; &security;} #O6. Requred Header, do not delete print "Content-type: text/html\n\n"; print "$templatestart\n"; print "

Delete this Record?

\n"; ($Medium,$Image_Upload,$Artist,$Residence,$Description,$Search,$skipthisfield)=split (/$delimiter/,$linetokeep); #O7. Show validation HTML print "

\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
Medium: $Medium
Image_Upload: $Image_Upload
Artist: $Artist
Residence: $Residence
Description: $Description
Search: $Search

\n"; print "\n"; print "\n"; print "

\n"; #If opening.htm was not found, show default closing html codes print "$templateend\n"; exit; } #STEP P================================ sub makechange{ #P1. For each variable, translate it, remove any delimiters that #user may have accidentally included, replace hard returns with #HTML line breaks, and delete all carriage returns #Go to get variable subroutine and make sure add preferences apply if ($recordaction eq "Edited"){ &getvariables;} #P2. This step either replaces or empties the existing line if ($recordaction eq "Deleted"){ $replacementline="";} else{ $replacementline="$Medium$delimiter$Image_Upload$delimiter$Artist$delimiter$Residence$delimiter$Description$delimiter$Search";} $problem="Can't open data file to read from it"; open (FILE,"$data") || &security; @all=; close (FILE); $linenumberpass--; $all[$linenumberpass]=$replacementline; $problem="Can't open temporary file. You need to chmod 777 the directory your data file is in. See the help files under Permissions for Class B Scripts."; #P6. Write the entire changed file to a temporary file open (FILE2,">$data.tmp") || &security; foreach $line (@all){ $line=~s/\n//g; print FILE2 "$line\n";} close(FILE2); #P7. Rename the temp file to your master data file $problem="Can't rename file after making change"; rename("$data.tmp", "$data") || &security; print "Content-type: text/html\n\n"; #P8. If can't find opening html, display default header print "$templatestart\n"; print "Your record has been $recordaction. Please click here to continue.\n"; close (FILE); #If opening.htm was not found, show default closing html codes print "$templateend\n"; exit; } #STEP Q================================ #This subroutine adds records to your database sub addrecord{ #Q1. Check password if ($adminpassword ne $checkpassword && $adminpassword){ $problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem."; &security;} &getvariables; $replacementline="$Medium$delimiter$Image_Upload$delimiter$Artist$delimiter$Residence$delimiter$Description$delimiter$Search"; #Q3. Write the new record to the bottom of the data file $problem="Can't write to the data file. Please verify its location and change its permissions to 777."; open (FILE2,">>$data") || &security; print FILE2 "$replacementline\n"; close(FILE2); print "Content-type: text/html\n\n"; #Q4. If can't find opening html, display default header print "$templatestart\n"; print "Your record has been added. Please click here to continue.\n"; #If opening.htm was not found, show default closing html codes print "$templateend\n"; exit; } #STEP R================================ sub getvariables{ #R1. This step checks your variables before adding/editing them $Medium=$query->param('Medium'); $Image_Upload=$query->param('Image_Upload'); $Artist=$query->param('Artist'); $Residence=$query->param('Residence'); $Description=$query->param('Description'); $Search=$query->param('Search'); #R3. Replace hard returns with
, cut carriage returns $Medium=~s/\n/
/g; $Medium=~s/\r//g; if ($Medium eq "Select"){ $Medium="";} #R3. Replace hard returns with
, cut carriage returns $Image_Upload=~s/\n/
/g; $Image_Upload=~s/\r//g; if ($Image_Upload eq "Select"){ $Image_Upload="";} #R3. Replace hard returns with
, cut carriage returns $Artist=~s/\n/
/g; $Artist=~s/\r//g; if ($Artist eq "Select"){ $Artist="";} #R3. Replace hard returns with
, cut carriage returns $Residence=~s/\n/
/g; $Residence=~s/\r//g; if ($Residence eq "Select"){ $Residence="";} #R3. Replace hard returns with
, cut carriage returns $Description=~s/\n/
/g; $Description=~s/\r//g; if ($Description eq "Select"){ $Description="";} #R3. Replace hard returns with
, cut carriage returns $Search=~s/\n/
/g; $Search=~s/\r//g; if ($Search eq "Select"){ $Search="";} if ($Image_Upload && $actiontotake!~/edit/i){ #Get Unix time. Will constitute file name $tstamp=time; @splitparts=split(/\./,$Image_Upload); $parts=@splitparts; $parts--; $extension=lc($splitparts[$parts]); if ($extension!~/gif|jpg|jpeg/i){ $problem="You are attempting to upload a file with an incorrect extension .$splitparts[$parts]. For security reasons, only image files .gif, .jpg, or .jpeg extensions can be uploaded."; &security; } if ($Image_Upload=~/\.cgi|\.pl|\.exe/i){ $problem="You are attempting to upload a file that could be hazardous to the server. Please make sure that you upload only files with .gif, .jpg, or .jpeg extensions. .pl or .cgi can't make up any part of the filename you are uploading."; &security; } $Imagemaximum=$Imagemaxz*1024; $size=-1024; $problem="Can't write the image to the directory $Imageuploadpath. Make sure that you have set the permissions for this directory to 766."; open (OUTFILE,">$Imageuploadpath$tstamp.$extension") || &security; while ($bytesread=read($Image_Upload,$buffer,1024)) { $size=$size+1024; if ($size>$Imagemaximum){ $problem="You are attempting to upload a file that is too large. Please decrease the size of the image and try again."; push(@deletefiles,"$Imageuploadpath$tstamp.$extension"); unlink(@deletefiles); &security; } print OUTFILE $buffer;} close(OUTFILE); $Image_Upload="$tstamp.$extension"; } }