Solved

Renaming Files after upload

Posted on 2000-02-18
7
279 Views
Last Modified: 2010-03-05
This is probly a stupid question but id like to know how to rename a file after upload and retain the original extention using data from a text file
0
Comment
Question by:Spearmon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 19

Expert Comment

by:Kim Ryan
ID: 2537477
Could you explain a bit more. Is the file extension contained in the file you want to rename? It would be eaiser if you first copied your file, renamed it, uploaded it and then deleted the copy.
0
 

Author Comment

by:Spearmon
ID: 2537746
this is my script I didnt write it What id like to know is how could i rename the file after upload using data from a text file for the new name but retain the files original extention persay .zip ETC. I was thinking i would just get the name from a counters data file which counts hits to the upload page

heres the html for the script
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide from browsers

function check(theform)
{
if (theform.elements[0].value == "")
  {
alert ("You must select a file to upload!")
  }
  else
{
theform.submit()
}
}
// Stop hiding --></SCRIPT>
<FORM enctype="multipart/form-data" ACTION="script.pl" METHOD="POST"><strong><br><br><font size="2">
<img src="vb.gif">&nbspUpload Visual Basic Samples<br><br><br>
<INPUT TYPE="FILE" NAME="file-to-upload-01" SIZE="25"><br><br><INPUT TYPE="button" VALUE="Submit" onClick="check(this.form)">
</form>




Heres the script
#!/usr/bin/perl


BEGIN {

$SAVE_DIRECTORY = "/web/space/d02/sec/s19/U0000eyG/www/upload/upvb/app";
$MAXIMUM_UPLOAD = 0;
$ALLOW_INDEX = 0;
$SUCCESS_LOCATION = ""
                             
}


      $| = 1;
      chop $SAVE_DIRECTORY if ($SAVE_DIRECTORY =~ /\/$/);
      use CGI qw(:standard);
      $query = new CGI;

      if ( (!(-e $SAVE_DIRECTORY)) ||
             (!(-W $SAVE_DIRECTORY)) ||
             (!(-d $SAVE_DIRECTORY)) ) {
            print header;
            print <<__END_OF_HTML_CODE__;
            
<HTML>
<HEAD>
<TITLE>$Title</TITLE>
<META NAME=keywords content= $Keywords>
<META NAME=Author CONTENT=$Contact_Email>
<STYLE fprolloverstyle>A:hover {
      COLOR: ff0000;
}
</STYLE>
<SCRIPT language=JavaScript>

<!--
var browser=false;
browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion);

if (browser_name == \"Netscape\" && browser_version >= 3.0) { browser = 'true'; }
else if (browser_name == \"Microsoft Internet Explorer\" && browser_version >= 4.0) { browser = 'true'; }
else { browser = 'false'; }


if (browser){
var object=new Array();
object['home']= new objectdata(120,24,\"../../../img/home-h.gif\",\"../../../img/home.gif\",\"Visual Basic Archive\");
object['overview']= new objectdata(120,24,\"../../../img/overview-h.gif\",\"../../../img/overview.gif\",\"C++ Archive\");
object['support']= new objectdata(120,24,\"../../../img/support-h.gif\",\"../../../img/support.gif\",\"Perl Archive\");
object['pricing']= new objectdata(120,24,\"../../../img/pricing-h.gif\",\"../../../img/pricing.gif\",\"Registry Archive\");
object['ecommerce']= new objectdata(120,24,\"../../../img/ecommerce-h.gif\",\"../../../img/ecommerce.gif\",\"Submit Source Code\");
object['order']= new objectdata(120,24,\"../../../img/order-h.gif\",\"../../../img/order.gif\",\"Interactive Support Forum\");
object['about']= new objectdata(120,24,\"../../../img/about-h.gif\",\"../../../img/about.gif\",\"Advertise\");
object['contact']= new objectdata(120,24,\"../../../img/contact-h.gif\",\"../../../img/contact.gif\",\"Contact\");
object['resellers']= new objectdata(120,24,\"../../../img/resellers-h.gif\",\"../../../img/resellers.gif\",\"Top Code Competition\");
}

function objectdata(hsize,vsize,replaceimg,restoreimg,mess)
{if(browser)
{                this.mess=mess;
                        this.simg=new Image(hsize,vsize);
                        this.simg.src=replaceimg;
                        this.rimg=new Image(hsize,vsize);
                        this.rimg.src=restoreimg; }}

function ReplaceOrig(name)
{if(browser)
{window.status=object[name].mess;
document[name].src=object[name].simg.src;}}

function RestoreOrig(name)
{if(browser)
{window.status=\"\";
document[name].src=object[name].rimg.src;}}


// End of JavaScript
// -->

</SCRIPT>


<META content= MSHTML 5.00.2314.1000  name=GENERATOR></HEAD>
<BODY aLink= 0202a4 bgColor=white link= 0202a4 vLink= 0202a4>
<DIV align=center>
<CENTER>
<TABLE bgColor= ffffff border=0 cellPadding=0 cellSpacing=0>
  <TBODY>
  <TR>
    <TD><IMG border=0 height=104
      src= ../../../img/1-1.gif  width=120></TD>
    <TD background= ../../../img/top.gif ><IMG
      border=0 height=104 src= ../../../img/1-2.gif  
      width=473></TD>
    <TD><IMG border=0 height=104
      src= ../../../img/1-3.gif  width=23></TD></TR>
  <TR>
    <TD align=left background= ../../../img/left.gif  
    vAlign=top><IMG border=0 height=38
      src= ../../../img/2-1.gif  width=120><BR><A
      href= ../../../vb/index.html  onmouseout= RestoreOrig('home');  
      onmouseover= ReplaceOrig('home');return true; ><IMG border=0 height=24
      name=home src= ../../../img/home.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../vc/index.html  
      onmouseout= RestoreOrig('overview');  
      onmouseover= ReplaceOrig('overview');return true; ><IMG border=0 height=24
      name=overview src= ../../../img/overview.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../perl/index.html  onmouseout= RestoreOrig('support');  
      onmouseover= ReplaceOrig('support');return true; ><IMG border=0 height=24
      name=support src= ../../../img/support.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../regedit/index.html  onmouseout= RestoreOrig('pricing');  
      onmouseover= ReplaceOrig('pricing');return true; ><IMG border=0 height=24
      name=pricing src= ../../../img/pricing.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../submit.html  
      onmouseout= RestoreOrig('ecommerce');  
      onmouseover= ReplaceOrig('ecommerce');return true; ><IMG border=0
      height=24 name=ecommerce
      src= ../../../img/ecommerce.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../support/index.html  
      onmouseout= RestoreOrig('order');  
      onmouseover= ReplaceOrig('order');return true; ><IMG border=0 height=24
      name=order src= ../../../img/order.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../advertise.html  
      onmouseout= RestoreOrig('about');  
      onmouseover= ReplaceOrig('about');return true; ><IMG border=0 height=24
      name=about src= ../../../img/about.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../contact.html  
      onmouseout= RestoreOrig('contact');  
      onmouseover= ReplaceOrig('contact');return true; ><IMG border=0 height=24
      name=contact src= ../../../img/contact.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../prize.html  
      onmouseout= RestoreOrig('resellers');  
      onmouseover= ReplaceOrig('resellers');return true; ><IMG border=0
      height=24 name=resellers
      src= ../../../img/resellers.gif  width=120
      naturalsizeflag= 0 ></A><BR></TD>
    <TD align=left vAlign=top>
      <TABLE border=0 cellPadding=0 cellSpacing=0 width=470>
        <TBODY><tr>
       

            <H3>Bad Directory</H3>
            </center>
<split here>
        <TR>
          <TD align=left colSpan=4 height=1 vAlign=top width=460>&nbsp; </TD></TR>
        <TR>
         
        <TR>
          <TD align=middle colSpan=4 height=1 vAlign=center width=468>
            <HR>
          </TD></TR>
        <TR>
          <TD align=middle colSpan=4 height=82 vAlign=center width=468>
            <P align=center></P>Banner Space Click here to <a href= ../../../advertise.html >Advertise</a> with us</TD></TR>
        <TR>
          <TD width=10></TD>
          <TD>&nbsp;</TD></TR></TBODY></TABLE></TD>
    <TD align=left background= ../../../img/right.gif  
    vAlign=top><BR><IMG border=0 height=6
      src= ../../../img/right.gif  width=23></TD></TR>
  <TR>
    <TD background= ../../../img/left.gif ><IMG
      border=0 height=8 src= ../../../img/left.gif  
      width=120></TD>
    <TD>
      <P align=center></P></TD>
    <TD background= ../../../img/right.gif ><IMG
      border=0 height=6 src= ../../../img/right.gif  
      width=23></TD></TR>
  <TR>
    <TD background= ../../../img/left.gif ><IMG
      border=0 height=24 src= ../../../img/21-1.gif  
      width=120></TD>
    <TD background= ../../../img/bottom.gif >
      <P align=center><IMG border=0 height=24
      src= ../../../img/bottom.gif  width=7></P></TD>
    <TD background= ../../../img/right.gif ><IMG
      border=0 height=24 src= ../../../img/21-3.gif  
      width=23></TD></TR></TBODY></TABLE></CENTER></DIV></BODY></HTML>
            
__END_OF_HTML_CODE__
            exit;
      }
      
      foreach $key (sort {$a <=> $b} $query->param()) {
            next if ($key =~ /^\s*$/);
            next if ($query->param($key) =~ /^\s*$/);
            next if ($key !~ /^file-to-upload-(\d+)$/);
            $Number = $1;
            
            if ($query->param($key) =~ /([^\/\\]+)$/) {
                  $Filename = $1;
                  $Filename =~ s/^\.+//;
                  $File_Handle = $query->param($key);
                  
                  if (!$ALLOW_INDEX && $Filename =~ /^index/i) {
                        print header;
                        print <<__END_OF_HTML_CODE__;
                        
                           <HEAD>
<TITLE>$Title</TITLE>
<META NAME=keywords content= $Keywords>
<META NAME=Author CONTENT=$Contact_Email>
<STYLE fprolloverstyle>A:hover {
      COLOR: ff0000;
}
</STYLE>
<SCRIPT language=JavaScript>

<!--
var browser=false;
browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion);

if (browser_name == \"Netscape\" && browser_version >= 3.0) { browser = 'true'; }
else if (browser_name == \"Microsoft Internet Explorer\" && browser_version >= 4.0) { browser = 'true'; }
else { browser = 'false'; }


if (browser){
var object=new Array();
object['home']= new objectdata(120,24,\"../../../img/home-h.gif\",\"../../../img/home.gif\",\"Visual Basic Archive\");
object['overview']= new objectdata(120,24,\"../../../img/overview-h.gif\",\"../../../img/overview.gif\",\"C++ Archive\");
object['support']= new objectdata(120,24,\"../../../img/support-h.gif\",\"../../../img/support.gif\",\"Perl Archive\");
object['pricing']= new objectdata(120,24,\"../../../img/pricing-h.gif\",\"../../../img/pricing.gif\",\"Registry Archive\");
object['ecommerce']= new objectdata(120,24,\"../../../img/ecommerce-h.gif\",\"../../../img/ecommerce.gif\",\"Submit Source Code\");
object['order']= new objectdata(120,24,\"../../../img/order-h.gif\",\"../../../img/order.gif\",\"Interactive Support Forum\");
object['about']= new objectdata(120,24,\"../../../img/about-h.gif\",\"../../../img/about.gif\",\"Advertise\");
object['contact']= new objectdata(120,24,\"../../../img/contact-h.gif\",\"../../../img/contact.gif\",\"Contact\");
object['resellers']= new objectdata(120,24,\"../../../img/resellers-h.gif\",\"../../../img/resellers.gif\",\"Top Code Competition\");
}

function objectdata(hsize,vsize,replaceimg,restoreimg,mess)
{if(browser)
{                this.mess=mess;
                        this.simg=new Image(hsize,vsize);
                        this.simg.src=replaceimg;
                        this.rimg=new Image(hsize,vsize);
                        this.rimg.src=restoreimg; }}

function ReplaceOrig(name)
{if(browser)
{window.status=object[name].mess;
document[name].src=object[name].simg.src;}}

function RestoreOrig(name)
{if(browser)
{window.status=\"\";
document[name].src=object[name].rimg.src;}}


// End of JavaScript
// -->

</SCRIPT>


<META content= MSHTML 5.00.2314.1000  name=GENERATOR></HEAD>
<BODY aLink= 0202a4 bgColor=white link= 0202a4 vLink= 0202a4>
<DIV align=center>
<CENTER>
<TABLE bgColor= ffffff border=0 cellPadding=0 cellSpacing=0>
  <TBODY>
  <TR>
    <TD><IMG border=0 height=104
      src= ../../../img/1-1.gif  width=120></TD>
    <TD background= ../../../img/top.gif ><IMG
      border=0 height=104 src= ../../../img/1-2.gif  
      width=473></TD>
    <TD><IMG border=0 height=104
      src= ../../../img/1-3.gif  width=23></TD></TR>
  <TR>
    <TD align=left background= ../../../img/left.gif  
    vAlign=top><IMG border=0 height=38
      src= ../../../img/2-1.gif  width=120><BR><A
      href= ../../../vb/index.html  onmouseout= RestoreOrig('home');  
      onmouseover= ReplaceOrig('home');return true; ><IMG border=0 height=24
      name=home src= ../../../img/home.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../vc/index.html  
      onmouseout= RestoreOrig('overview');  
      onmouseover= ReplaceOrig('overview');return true; ><IMG border=0 height=24
      name=overview src= ../../../img/overview.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../perl/index.html  onmouseout= RestoreOrig('support');  
      onmouseover= ReplaceOrig('support');return true; ><IMG border=0 height=24
      name=support src= ../../../img/support.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../regedit/index.html  onmouseout= RestoreOrig('pricing');  
      onmouseover= ReplaceOrig('pricing');return true; ><IMG border=0 height=24
      name=pricing src= ../../../img/pricing.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../submit.html  
      onmouseout= RestoreOrig('ecommerce');  
      onmouseover= ReplaceOrig('ecommerce');return true; ><IMG border=0
      height=24 name=ecommerce
      src= ../../../img/ecommerce.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../support/index.html  
      onmouseout= RestoreOrig('order');  
      onmouseover= ReplaceOrig('order');return true; ><IMG border=0 height=24
      name=order src= ../../../img/order.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../advertise.html  
      onmouseout= RestoreOrig('about');  
      onmouseover= ReplaceOrig('about');return true; ><IMG border=0 height=24
      name=about src= ../../../img/about.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../contact.html  
      onmouseout= RestoreOrig('contact');  
      onmouseover= ReplaceOrig('contact');return true; ><IMG border=0 height=24
      name=contact src= ../../../img/contact.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../prize.html  
      onmouseout= RestoreOrig('resellers');  
      onmouseover= ReplaceOrig('resellers');return true; ><IMG border=0
      height=24 name=resellers
      src= ../../../img/resellers.gif  width=120
      naturalsizeflag= 0 ></A><BR></TD>
    <TD align=left vAlign=top>
      <TABLE border=0 cellPadding=0 cellSpacing=0 width=470>
        <TBODY><center><strong>
       Your file name contained an illegal key. Please rename your file and try again.
          </center></strong>
<split here>
        <center>
                        <H3>Filename Problem</H3>
                        </center>
                  <split here><br><br><br><br>
        <TR>
          <TD align=left colSpan=4 height=1 vAlign=top width=460>&nbsp; </TD></TR>
        <TR>
         
        <TR>
          <TD align=middle colSpan=4 height=1 vAlign=center width=468>
            <HR>
          </TD></TR>
        <TR>
          <TD align=middle colSpan=4 height=82 vAlign=center width=468>
            <P align=center></P>Banner Space Click here to <a href= ../../../advertise.html >Advertise</a> with us</TD></TR>
        <TR>
          <TD width=10></TD>
          <TD>&nbsp;</TD></TR></TBODY></TABLE></TD>
    <TD align=left background= ../../../img/right.gif  
    vAlign=top><BR><IMG border=0 height=6
      src= ../../../img/right.gif  width=23></TD></TR>
  <TR>
    <TD background= ../../../img/left.gif ><IMG
      border=0 height=8 src= ../../../img/left.gif  
      width=120></TD>
    <TD>
      <P align=center></P></TD>
    <TD background= ../../../img/right.gif ><IMG
      border=0 height=6 src= ../../../img/right.gif  
      width=23></TD></TR>
  <TR>
    <TD background= ../../../img/left.gif ><IMG
      border=0 height=24 src= ../../../img/21-1.gif  
      width=120></TD>
    <TD background= ../../../img/bottom.gif >
      <P align=center><IMG border=0 height=24
      src= ../../../img/bottom.gif  width=7></P></TD>
    <TD background= ../../../img/right.gif ><IMG
      border=0 height=24 src= ../../../img/21-3.gif  
      width=23></TD></TR></TBODY></TABLE></CENTER></DIV></BODY></HTML>
      
__END_OF_HTML_CODE__
                        exit;
                  }
            } else {
                  $FILENAME_IN_QUESTION = $query->param($key);
                  
                  print header;
                  print <<__END_OF_HTML_CODE__;
                  
            <TITLE>$Title</TITLE>
<META NAME=keywords content= $Keywords>
<META NAME=Author CONTENT=$Contact_Email>
<STYLE fprolloverstyle>A:hover {
      COLOR: ff0000;
}
</STYLE>
<SCRIPT language=JavaScript>

<!--
var browser=false;
browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion);

if (browser_name == \"Netscape\" && browser_version >= 3.0) { browser = 'true'; }
else if (browser_name == \"Microsoft Internet Explorer\" && browser_version >= 4.0) { browser = 'true'; }
else { browser = 'false'; }


if (browser){
var object=new Array();
object['home']= new objectdata(120,24,\"../../../img/home-h.gif\",\"../../../img/home.gif\",\"Visual Basic Archive\");
object['overview']= new objectdata(120,24,\"../../../img/overview-h.gif\",\"../../../img/overview.gif\",\"C++ Archive\");
object['support']= new objectdata(120,24,\"../../../img/support-h.gif\",\"../../../img/support.gif\",\"Perl Archive\");
object['pricing']= new objectdata(120,24,\"../../../img/pricing-h.gif\",\"../../../img/pricing.gif\",\"Registry Archive\");
object['ecommerce']= new objectdata(120,24,\"../../../img/ecommerce-h.gif\",\"../../../img/ecommerce.gif\",\"Submit Source Code\");
object['order']= new objectdata(120,24,\"../../../img/order-h.gif\",\"../../../img/order.gif\",\"Interactive Support Forum\");
object['about']= new objectdata(120,24,\"../../../img/about-h.gif\",\"../../../img/about.gif\",\"Advertise\");
object['contact']= new objectdata(120,24,\"../../../img/contact-h.gif\",\"../../../img/contact.gif\",\"Contact\");
object['resellers']= new objectdata(120,24,\"../../../img/resellers-h.gif\",\"../../../img/resellers.gif\",\"Top Code Competition\");
}

function objectdata(hsize,vsize,replaceimg,restoreimg,mess)
{if(browser)
{                this.mess=mess;
                        this.simg=new Image(hsize,vsize);
                        this.simg.src=replaceimg;
                        this.rimg=new Image(hsize,vsize);
                        this.rimg.src=restoreimg; }}

function ReplaceOrig(name)
{if(browser)
{window.status=object[name].mess;
document[name].src=object[name].simg.src;}}

function RestoreOrig(name)
{if(browser)
{window.status=\"\";
document[name].src=object[name].rimg.src;}}


// End of JavaScript
// -->

</SCRIPT>


<META content= MSHTML 5.00.2314.1000  name=GENERATOR></HEAD>
<BODY aLink= 0202a4 bgColor=white link= 0202a4 vLink= 0202a4>
<DIV align=center>
<CENTER>
<TABLE bgColor= ffffff border=0 cellPadding=0 cellSpacing=0>
  <TBODY>
  <TR>
    <TD><IMG border=0 height=104
      src= ../../../img/1-1.gif  width=120></TD>
    <TD background= ../../../img/top.gif ><IMG
      border=0 height=104 src= ../../../img/1-2.gif  
      width=473></TD>
    <TD><IMG border=0 height=104
      src= ../../../img/1-3.gif  width=23></TD></TR>
  <TR>
    <TD align=left background= ../../../img/left.gif  
    vAlign=top><IMG border=0 height=38
      src= ../../../img/2-1.gif  width=120><BR><A
      href= ../../../vb/index.html  onmouseout= RestoreOrig('home');  
      onmouseover= ReplaceOrig('home');return true; ><IMG border=0 height=24
      name=home src= ../../../img/home.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../vc/index.html  
      onmouseout= RestoreOrig('overview');  
      onmouseover= ReplaceOrig('overview');return true; ><IMG border=0 height=24
      name=overview src= ../../../img/overview.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../perl/index.html  onmouseout= RestoreOrig('support');  
      onmouseover= ReplaceOrig('support');return true; ><IMG border=0 height=24
      name=support src= ../../../img/support.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../regedit/index.html  onmouseout= RestoreOrig('pricing');  
      onmouseover= ReplaceOrig('pricing');return true; ><IMG border=0 height=24
      name=pricing src= ../../../img/pricing.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../submit.html  
      onmouseout= RestoreOrig('ecommerce');  
      onmouseover= ReplaceOrig('ecommerce');return true; ><IMG border=0
      height=24 name=ecommerce
      src= ../../../img/ecommerce.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../support/index.html  
      onmouseout= RestoreOrig('order');  
      onmouseover= ReplaceOrig('order');return true; ><IMG border=0 height=24
      name=order src= ../../../img/order.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../advertise.html  
      onmouseout= RestoreOrig('about');  
      onmouseover= ReplaceOrig('about');return true; ><IMG border=0 height=24
      name=about src= ../../../img/about.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../contact.html  
      onmouseout= RestoreOrig('contact');  
      onmouseover= ReplaceOrig('contact');return true; ><IMG border=0 height=24
      name=contact src= ../../../img/contact.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../prize.html  
      onmouseout= RestoreOrig('resellers');  
      onmouseover= ReplaceOrig('resellers');return true; ><IMG border=0
      height=24 name=resellers
      src= ../../../img/resellers.gif  width=120
      naturalsizeflag= 0 ></A><BR></TD>
    <TD align=left vAlign=top>
      <TABLE border=0 cellPadding=0 cellSpacing=0 width=470>
        <TBODY><center><strong>
        Your file name contained an illegal key. Please rename your file and try again.
          </center></strong>
<split here>
        <center>
                        <H3>Filename Problem</H3>
                        </center>
                  <split here><br><br><br>
        <TR>
          <TD align=left colSpan=4 height=1 vAlign=top width=460>&nbsp;<br><br><br> </TD></TR>
        <TR>
         
        <TR>
          <TD align=middle colSpan=4 height=1 vAlign=center width=468>
            <HR>
          </TD></TR>
        <TR>
          <TD align=middle colSpan=4 height=82 vAlign=center width=468>
            <P align=center></P>Banner Space Click here to <a href= ../../../advertise.html >Advertise</a> with us</TD></TR>
        <TR>
          <TD width=10></TD>
          <TD>&nbsp;</TD></TR></TBODY></TABLE></TD>
    <TD align=left background= ../../../img/right.gif  
    vAlign=top><BR><IMG border=0 height=6
      src= ../../../img/right.gif  width=23></TD></TR>
  <TR>
    <TD background= ../../../img/left.gif ><IMG
      border=0 height=8 src= ../../../img/left.gif  
      width=120></TD>
    <TD>
      <P align=center></P></TD>
    <TD background= ../../../img/right.gif ><IMG
      border=0 height=6 src= ../../../img/right.gif  
      width=23></TD></TR>
  <TR>
    <TD background= ../../../img/left.gif ><IMG
      border=0 height=24 src= ../../../img/21-1.gif  
      width=120></TD>
    <TD background= ../../../img/bottom.gif >
      <P align=center><IMG border=0 height=24
      src= ../../../img/bottom.gif  width=7></P></TD>
    <TD background= ../../../img/right.gif ><IMG
      border=0 height=24 src= ../../../img/21-3.gif  
      width=23></TD></TR></TBODY></TABLE></CENTER></DIV></BODY></HTML>
      

__END_OF_HTML_CODE__
                  exit;
            }
            
        if (!open(OUTFILE, ">$SAVE_DIRECTORY\/$Filename")) {
            print "Content-type: text/plain\n\n";
            print "-------------------------\n";
            print "Error:\n";
            print "-------------------------\n";
            print "File: $SAVE_DIRECTORY\/$Filename\n";
            print "-------------------------\n";
              print "There was an error opening the Output File\n";
              print "for Writing.\n\n";
              print "Make sure that the directory:\n";
              print "$SAVE_DIRECTORY\n";
              print "has been chmodded with the permissions '777'.\n\n";
              print "Also, make sure that if your attempting\n";
              print "to overwrite an existing file, that the\n";
              print "existing file is chmodded '666' or better.\n\n";
              print "The Error message below should help you diagnose\n";
              print "the problem.\n\n";
              print "Error: $!\n";
            exit;
        }

            undef $BytesRead;
            undef $Buffer;
            
        while ($Bytes = read($File_Handle,$Buffer,1024)) {
                  $BytesRead += $Bytes;
            print OUTFILE $Buffer;
        }
            
            push(@Files_Written, "$SAVE_DIRECTORY\/$Filename");
            $TOTAL_BYTES += $BytesRead;
            $Confirmation{$File_Handle} = $BytesRead;

        close($File_Handle);
            close(OUTFILE);

        chmod (0666, "$SAVE_DIRECTORY\/$Filename");
    }

      $FILES_UPLOADED = scalar(keys(%Confirmation));

      
      if ($TOTAL_BYTES > $MAXIMUM_UPLOAD && $MAXIMUM_UPLOAD > 0) {
            foreach $File (@Files_Written) {
                  unlink $File;
            }
            
            print header;
            print <<__END_OF_HTML_CODE__;
            
            <TITLE>$Title</TITLE>
<META NAME=keywords content= $Keywords>
<META NAME=Author CONTENT=$Contact_Email>
<STYLE fprolloverstyle>A:hover {
      COLOR: ff0000;
}
</STYLE>
<SCRIPT language=JavaScript>

<!--
var browser=false;
browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion);

if (browser_name == \"Netscape\" && browser_version >= 3.0) { browser = 'true'; }
else if (browser_name == \"Microsoft Internet Explorer\" && browser_version >= 4.0) { browser = 'true'; }
else { browser = 'false'; }


if (browser){
var object=new Array();
object['home']= new objectdata(120,24,\"../../../img/home-h.gif\",\"../../../img/home.gif\",\"Visual Basic Archive\");
object['overview']= new objectdata(120,24,\"../../../img/overview-h.gif\",\"../../../img/overview.gif\",\"C++ Archive\");
object['support']= new objectdata(120,24,\"../../../img/support-h.gif\",\"../../../img/support.gif\",\"Perl Archive\");
object['pricing']= new objectdata(120,24,\"../../../img/pricing-h.gif\",\"../../../img/pricing.gif\",\"Registry Archive\");
object['ecommerce']= new objectdata(120,24,\"../../../img/ecommerce-h.gif\",\"../../../img/ecommerce.gif\",\"Submit Source Code\");
object['order']= new objectdata(120,24,\"../../../img/order-h.gif\",\"../../../img/order.gif\",\"Interactive Support Forum\");
object['about']= new objectdata(120,24,\"../../../img/about-h.gif\",\"../../../img/about.gif\",\"Advertise\");
object['contact']= new objectdata(120,24,\"../../../img/contact-h.gif\",\"../../../img/contact.gif\",\"Contact\");
object['resellers']= new objectdata(120,24,\"../../../img/resellers-h.gif\",\"../../../img/resellers.gif\",\"Top Code Competition\");
}

function objectdata(hsize,vsize,replaceimg,restoreimg,mess)
{if(browser)
{                this.mess=mess;
                        this.simg=new Image(hsize,vsize);
                        this.simg.src=replaceimg;
                        this.rimg=new Image(hsize,vsize);
                        this.rimg.src=restoreimg; }}

function ReplaceOrig(name)
{if(browser)
{window.status=object[name].mess;
document[name].src=object[name].simg.src;}}

function RestoreOrig(name)
{if(browser)
{window.status=\"\";
document[name].src=object[name].rimg.src;}}


// End of JavaScript
// -->

</SCRIPT>


<META content= MSHTML 5.00.2314.1000  name=GENERATOR></HEAD>
<BODY aLink= 0202a4 bgColor=white link= 0202a4 vLink= 0202a4>
<DIV align=center>
<CENTER>
<TABLE bgColor= ffffff border=0 cellPadding=0 cellSpacing=0>
  <TBODY>
  <TR>
    <TD><IMG border=0 height=104
      src= ../../../img/1-1.gif  width=120></TD>
    <TD background= ../../../img/top.gif ><IMG
      border=0 height=104 src= ../../../img/1-2.gif  
      width=473></TD>
    <TD><IMG border=0 height=104
      src= ../../../img/1-3.gif  width=23></TD></TR>
  <TR>
    <TD align=left background= ../../../img/left.gif  
    vAlign=top><IMG border=0 height=38
      src= ../../../img/2-1.gif  width=120><BR><A
      href= ../../../vb/index.html  onmouseout= RestoreOrig('home');  
      onmouseover= ReplaceOrig('home');return true; ><IMG border=0 height=24
      name=home src= ../../../img/home.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../vc/index.html  
      onmouseout= RestoreOrig('overview');  
      onmouseover= ReplaceOrig('overview');return true; ><IMG border=0 height=24
      name=overview src= ../../../img/overview.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../perl/index.html  onmouseout= RestoreOrig('support');  
      onmouseover= ReplaceOrig('support');return true; ><IMG border=0 height=24
      name=support src= ../../../img/support.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../regedit/index.html  onmouseout= RestoreOrig('pricing');  
      onmouseover= ReplaceOrig('pricing');return true; ><IMG border=0 height=24
      name=pricing src= ../../../img/pricing.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../submit.html  
      onmouseout= RestoreOrig('ecommerce');  
      onmouseover= ReplaceOrig('ecommerce');return true; ><IMG border=0
      height=24 name=ecommerce
      src= ../../../img/ecommerce.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../support/index.html  
      onmouseout= RestoreOrig('order');  
      onmouseover= ReplaceOrig('order');return true; ><IMG border=0 height=24
      name=order src= ../../../img/order.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../advertise.html  
      onmouseout= RestoreOrig('about');  
      onmouseover= ReplaceOrig('about');return true; ><IMG border=0 height=24
      name=about src= ../../../img/about.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../contact.html  
      onmouseout= RestoreOrig('contact');  
      onmouseover= ReplaceOrig('contact');return true; ><IMG border=0 height=24
      name=contact src= ../../../img/contact.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../prize.html  
      onmouseout= RestoreOrig('resellers');  
      onmouseover= ReplaceOrig('resellers');return true; ><IMG border=0
      height=24 name=resellers
      src= ../../../img/resellers.gif  width=120
      naturalsizeflag= 0 ></A><BR></TD>
    <TD align=left vAlign=top>
      <TABLE border=0 cellPadding=0 cellSpacing=0 width=470>
        <TBODY><center><strong>
        Your File was rejected
          </center></strong>
<split here>
<center>
            <H3>Limit Reached</H3>
            <P>
            You have reached your upload limit.  You attempted to upload <B>$FILES_UPLOADED</B> files, totalling
            <B>$TOTAL_BYTES</B>.  This exceeds the maximum limit of <B>$MAXIMUM_UPLOAD</B> bytes, set by the system
            administrator.  <B>None</B> of your files were successfully saved.  Please try again.
            <P>
</center>
        <TR>
          <TD align=left colSpan=4 height=1 vAlign=top width=460>&nbsp; </TD></TR>
        <TR>
         
        <TR>
          <TD align=middle colSpan=4 height=1 vAlign=center width=468>
            <HR>
          </TD></TR>
        <TR>
          <TD align=middle colSpan=4 height=82 vAlign=center width=468>
            <P align=center></P>Banner Space Click here to <a href= ../../../advertise.html >Advertise</a> with us</TD></TR>
        <TR>
          <TD width=10></TD>
          <TD>&nbsp;</TD></TR></TBODY></TABLE></TD>
    <TD align=left background= ../../../img/right.gif  
    vAlign=top><BR><IMG border=0 height=6
      src= ../../../img/right.gif  width=23></TD></TR>
  <TR>
    <TD background= ../../../img/left.gif ><IMG
      border=0 height=8 src= ../../../img/left.gif  
      width=120></TD>
    <TD>
      <P align=center></P></TD>
    <TD background= ../../../img/right.gif ><IMG
      border=0 height=6 src= ../../../img/right.gif  
      width=23></TD></TR>
  <TR>
    <TD background= ../../../img/left.gif ><IMG
      border=0 height=24 src= ../../../img/21-1.gif  
      width=120></TD>
    <TD background= ../../../img/bottom.gif >
      <P align=center><IMG border=0 height=24
      src= ../../../img/bottom.gif  width=7></P></TD>
    <TD background= ../../../img/right.gif ><IMG
      border=0 height=24 src= ../../../img/21-3.gif  
      width=23></TD></TR></TBODY></TABLE></CENTER></DIV></BODY></HTML>
      

             
                        
__END_OF_HTML_CODE__
            exit;
      }
      
      if ($SUCCESS_LOCATION !~ /^\s*$/) {
            print $query->redirect($SUCCESS_LOCATION);
      } else {
      

            print header;
            print <<__END_OF_HTML_CODE__;
            
      <HEAD>
<TITLE>$Title</TITLE>
<META NAME=keywords content= $Keywords>
<META NAME=Author CONTENT=$Contact_Email>
<STYLE fprolloverstyle>A:hover {
      COLOR: ff0000;
}
</STYLE>
<SCRIPT language=JavaScript>

<!--
var browser=false;
browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion);

if (browser_name == \"Netscape\" && browser_version >= 3.0) { browser = 'true'; }
else if (browser_name == \"Microsoft Internet Explorer\" && browser_version >= 4.0) { browser = 'true'; }
else { browser = 'false'; }


if (browser){
var object=new Array();
object['home']= new objectdata(120,24,\"../../../img/home-h.gif\",\"../../../img/home.gif\",\"Visual Basic Archive\");
object['overview']= new objectdata(120,24,\"../../../img/overview-h.gif\",\"../../../img/overview.gif\",\"C++ Archive\");
object['support']= new objectdata(120,24,\"../../../img/support-h.gif\",\"../../../img/support.gif\",\"Perl Archive\");
object['pricing']= new objectdata(120,24,\"../../../img/pricing-h.gif\",\"../../../img/pricing.gif\",\"Registry Archive\");
object['ecommerce']= new objectdata(120,24,\"../../../img/ecommerce-h.gif\",\"../../../img/ecommerce.gif\",\"Submit Source Code\");
object['order']= new objectdata(120,24,\"../../../img/order-h.gif\",\"../../../img/order.gif\",\"Interactive Support Forum\");
object['about']= new objectdata(120,24,\"../../../img/about-h.gif\",\"../../../img/about.gif\",\"Advertise\");
object['contact']= new objectdata(120,24,\"../../../img/contact-h.gif\",\"../../../img/contact.gif\",\"Contact\");
object['resellers']= new objectdata(120,24,\"../../../img/resellers-h.gif\",\"../../../img/resellers.gif\",\"Top Code Competition\");
}

function objectdata(hsize,vsize,replaceimg,restoreimg,mess)
{if(browser)
{                this.mess=mess;
                        this.simg=new Image(hsize,vsize);
                        this.simg.src=replaceimg;
                        this.rimg=new Image(hsize,vsize);
                        this.rimg.src=restoreimg; }}

function ReplaceOrig(name)
{if(browser)
{window.status=object[name].mess;
document[name].src=object[name].simg.src;}}

function RestoreOrig(name)
{if(browser)
{window.status=\"\";
document[name].src=object[name].rimg.src;}}


// End of JavaScript
// -->

</SCRIPT>


<META content= MSHTML 5.00.2314.1000  name=GENERATOR></HEAD>
<BODY aLink= 0202a4 bgColor=white link= 0202a4 vLink= 0202a4>
<DIV align=center>
<CENTER>
<TABLE bgColor= ffffff border=0 cellPadding=0 cellSpacing=0>
  <TBODY>
  <TR>
    <TD><IMG border=0 height=104
      src= ../../../img/1-1.gif  width=120></TD>
    <TD background= ../../../img/top.gif ><IMG
      border=0 height=104 src= ../../../img/1-2.gif  
      width=473></TD>
    <TD><IMG border=0 height=104
      src= ../../../img/1-3.gif  width=23></TD></TR>
  <TR>
    <TD align=left background= ../../../img/left.gif  
    vAlign=top><IMG border=0 height=38
      src= ../../../img/2-1.gif  width=120><BR><A
      href= ../../../vb/index.html  onmouseout= RestoreOrig('home');  
      onmouseover= ReplaceOrig('home');return true; ><IMG border=0 height=24
      name=home src= ../../../img/home.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../vc/index.html  
      onmouseout= RestoreOrig('overview');  
      onmouseover= ReplaceOrig('overview');return true; ><IMG border=0 height=24
      name=overview src= ../../../img/overview.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../perl/index.html  onmouseout= RestoreOrig('support');  
      onmouseover= ReplaceOrig('support');return true; ><IMG border=0 height=24
      name=support src= ../../../img/support.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../regedit/index.html  onmouseout= RestoreOrig('pricing');  
      onmouseover= ReplaceOrig('pricing');return true; ><IMG border=0 height=24
      name=pricing src= ../../../img/pricing.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../submit.html  
      onmouseout= RestoreOrig('ecommerce');  
      onmouseover= ReplaceOrig('ecommerce');return true; ><IMG border=0
      height=24 name=ecommerce
      src= ../../../img/ecommerce.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../support/index.html  
      onmouseout= RestoreOrig('order');  
      onmouseover= ReplaceOrig('order');return true; ><IMG border=0 height=24
      name=order src= ../../../img/order.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../advertise.html  
      onmouseout= RestoreOrig('about');  
      onmouseover= ReplaceOrig('about');return true; ><IMG border=0 height=24
      name=about src= ../../../img/about.gif  width=120
      naturalsizeflag= 0 ></A><BR><A href= ../../../contact.html  
      onmouseout= RestoreOrig('contact');  
      onmouseover= ReplaceOrig('contact');return true; ><IMG border=0 height=24
      name=contact src= ../../../img/contact.gif  
      width=120 naturalsizeflag= 0 ></A><BR><A
      href= ../../../prize.html  
      onmouseout= RestoreOrig('resellers');  
      onmouseover= ReplaceOrig('resellers');return true; ><IMG border=0
      height=24 name=resellers
      src= ../../../img/resellers.gif  width=120
      naturalsizeflag= 0 ></A><BR></TD>
    <TD align=left vAlign=top>
      <TABLE border=0 cellPadding=0 cellSpacing=0 width=470>
        <TBODY><TR>
           
 

<SCRIPT LANGUAGE=\"JavaScript\">
<!-- Hide from browsers

function check(theform)
{
  if (theform.elements[1].value == \"\")
  {
        alert (\"You must enter a Title!\")
  }
  else
  {
    if (theform.elements[2].value == \"\")
    {
     alert (\" You Must Provide a Description!\")
         }
else
{
 if (theform.elements[3].value == \"\")
{
         alert (\"you must supply Keywords!\")
}

else
{
 if (theform.elements[5].value == \"\")
{
         alert (\"you must supply your name!\")
}
else
 {
 if (theform.elements[6].value == \"\")
{
         alert (\"You must enter a valid email address!\")
}
else
{
theform.submit()
    }  }
    }
}
}
}
// Stop hiding --></SCRIPT>      



<FORM ACTION= vbapp.pl  METHOD= POST >
                              <P align=center><B><FONT color=#0202a4 size=4>Add a Visual Basic Sample</FONT></B></P><br><Please Complete the following Fields<br>
                        <input type=hidden name=\"action\" value=\"additnow\">             
                                            <TR><TD ALIGN= right  VALIGN= TOP ><font face= arial  size=2>Title:</font></TD>
                                                <TD VALIGN= left >&nbsp;<INPUT TYPE= TEXT  NAME= Title  SIZE= 45  MAXLENGTH= 255 ><br><br></TD></TR>
                                            
                                            
                                            
                                            <TR><TD ALIGN= Right  VALIGN= TOP ><font face= arial  size=2>Description:</font></TD>
                                                <TD VALIGN= TOP >&nbsp;<TEXTAREA NAME= Description  ROWS= 3  COLS= 40  WRAP= VIRTUAL ></TEXTAREA><br><br></TD></TR><TR><TD ALIGN= Right  VALIGN= TOP ><font face= arial  size=2>Keywords:</font><br><font size= -2  face= arial ><b></b></TD>
                                                <TD VALIGN= TOP >&nbsp;<TEXTAREA NAME= Keywords  ROWS= 3  COLS= 40  WRAP= VIRTUAL ></TEXTAREA><br><br></TD></TR>
                                            <TR><TD ALIGN= Right  VALIGN= TOP ><font face= arial  size=2>Instructions:</font><br><font size= -2  face= arial ><b>Optional</b></TD>
                                                <TD VALIGN= TOP >&nbsp;<TEXTAREA NAME= Instructions  ROWS= 3  COLS= 40  WRAP= VIRTUAL ></TEXTAREA><br><br></TD></TR>
<TR><TD ALIGN= Right  VALIGN= TOP ><font face= arial  size=2></font><br><font size= -2  face= arial ><b></b></TD>


                                    
           
                                        
                                            
                                                
                                          
                                          <tr><td align=right valign=top><font face= arial  size=2>Contact Name:<br><font size= -2  face= arial ><b></b></font></td>
                                                <td VALIGN= TOP >&nbsp;<INPUT NAME= Contact_Name    SIZE=35><br><br><br><br></td></tr>                                         
                                          <tr><td align=right valign=top><font face= arial  size=2>Contact Email:<br><font size= -2  face= arial ><b></b></font></td>
                                                <td VALIGN= TOP >&nbsp;<INPUT NAME= Contact_Email     SIZE=35><br><br><br><br></td></tr>                                         
                                          <tr><td align=right valign=top><font face= arial  size=2>Associated URL:<br><font size= -2  face= arial ><b>Optional</b></font></td>
                                                <td VALIGN= TOP >&nbsp;<INPUT NAME= URL     SIZE=35><br><br><br><br></td></tr>                                         
                                          <TR><TD ALIGN= Right  VALIGN= TOP ><font face= arial  size=2>Operating System:</font></TD><TD VALIGN= TOP >&nbsp;<SELECT NAME= OS   SIZE=1><OPTION>---<OPTION> Windows 98<OPTION> Windows NT 3.x<OPTION> Windows NT 4.x<OPTION>Windows 95<OPTION>Windows 9x<OPTION>Windows 9x and NT<OPTION>Windows NT</SELECT><br><br><br><br></TD></TR>
                              <input type=hidden name=file value=$Filename>
<tr><td align=right valign=top></td>
           <TD VALIGN= TOP >        <INPUT TYPE=\"button\" VALUE=\"Submit\" onClick=\"check(this.form)\">  <INPUT TYPE=\"button\" VALUE=\"Reset\" onClick=\"if (confirm) this.form.reset()\"></TD></TR>

        </form>

         <split here>
__END_OF_HTML_CODE__

            foreach $key (keys (%Confirmation)) {
                  
            }
            
            print <<__END_OF_HTML_CODE__;
            
              <TR>
         
        <TR>
          <TD width=10></TD>
          <TD>&nbsp;</TD></TR></TBODY></TABLE></TD>
    <TD align=left background= ../../../img/right.gif  
    vAlign=top><BR><IMG border=0 height=6
      src= ../../../img/right.gif  width=23></TD></TR>
  <TR>
    <TD background= ../../../img/left.gif ><IMG
      border=0 height=8 src= ../../../img/left.gif  
      width=120></TD>
    <TD>
      <P align=center></P></TD>
    <TD background= ../../../img/right.gif ><IMG
      border=0 height=6 src= ../../../img/right.gif  
      width=23></TD></TR>
  <TR>
    <TD background= ../../../img/left.gif ><IMG
      border=0 height=24 src= ../../../img/21-1.gif  
      width=120></TD>
    <TD background= ../../../img/bottom.gif >
      <P align=center><IMG border=0 height=24
      src= ../../../img/bottom.gif  width=7></P></TD>
    <TD background= ../../../img/right.gif ><IMG
      border=0 height=24 src= ../../../img/21-3.gif  
      width=23></TD></TR></TBODY></TABLE></CENTER></DIV></BODY></HTML>
__END_OF_HTML_CODE__
            exit;      
      }
      

# EOF
0
 
LVL 5

Expert Comment

by:thoellri
ID: 2538402
Spearmon,

how about this: Just before these lines:



                   push(@Files_Written, "$SAVE_DIRECTORY\/$Filename");
                   $TOTAL_BYTES += $BytesRead;

add before the "push" line:

  $Filename =~ /\.([^\.]{2,3})$/;
  $ext=$1 || "txt";
  do {
    $newname=sprintf("%8X-%4X-%4X",time,$$,rand(0xffff)).".$ext";
  } while (-f "$SAVE_DIRECTORY\/$newname");
  rename("$SAVE_DIRECTORY\/$Filename", "$SAVE_DIRECTORY\/$newname") || die "Whoops - can't rename $!";
  $Filename=$newname;

The first line looks for a 2-3 character extension (.zip, .exe, .ps, ...). The second line assigns $ext the extension found or a default extension, here "txt". The do-loop calculates a newname using the current time, the process-id and a random number. It retries this until the filename does not exist yet.
rename() renames the original file to the new file. You may have to add your error checking here.
And finally we assign the newname to the original filename variable.

The line after the "$Filename=$newname" should be the "push" line from the top.

Hope this helps
 Tobias


0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Accepted Solution

by:
KishoreS78 earned 50 total points
ID: 2543539
if u want u could use Net::FTP module
ansd upload ur file to the required
destination directory.
when u do it
use ftp ->rename("original filename","remote file name ");

or if u wanna be simple use a regular expression to change the name of the file to the name u want it.
0
 
LVL 5

Expert Comment

by:thoellri
ID: 2543568
KishoreS78,

can you share you knowledge about the "simple" regular expression solution? I don't understand what you're saying?

Tobias
0
 

Expert Comment

by:KishoreS78
ID: 2543585
u coulsd probably use a regular expression with subsitution operator to change the name of the file.but iam thinking that this may not work.i guess this could be a solution to chnage the name of the file before uploading.will heve to write a script and see if it works.but iam sure with Net::FTP module u will get a solution to the answer.
guys is there any other module that provides this facilty
0
 
LVL 5

Expert Comment

by:thoellri
ID: 2543601
Did you understand the question he asked in the first place? At what point would the FTP module kick in? User A uploads (!!!) to Web site B and you open a ftp connection to where?
Oh now I understand, you quickly download perl and all the required modules to the users system, install it without his knowing, execute the script which reconnects to your server, renames the file he just uploaded and then delete the perl-installation again? Oh, that makes sense.

Thanks for sharing.
  Tobias
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question