How to copy file from one source to other source?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Archanak
    New Member
    • Sep 2006
    • 79

    How to copy file from one source to other source?

    Hi,

    I am uploading a zipfile and i want to copy the file to some other directory i tried like this.

    Here is the html code:

    Code:
    <html>
    <body>
    <form method='POST' enctype='multipart/form-data' action='/cgi-bin/zip.pl'>
    
    File to upload: <input type=file name=upfile><br>
    Notes about the file: <input type=text name=note><br>
    <br>
    <input type=submit value=Press> to upload the file!
    </form>
    </body>
    </html>
    Code:
    $param=param("upfile");
    system("cp $param /var/www/cgi-bin/Other/");
    But i couldn't copy the zipped file!!!

    How can i copy the file and unzip the directory?

    I don't want to use any modules!!!

    Regards
    Archana
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    Originally posted by Archanak
    Hi,

    I am uploading a zipfile and i want to copy the file to some other directory i tried like this.

    Here is the html code:

    Code:
    <html>
    <body>
    <form method='POST' enctype='multipart/form-data' action='/cgi-bin/zip.pl'>
    
    File to upload: <input type=file name=upfile><br>
    Notes about the file: <input type=text name=note><br>
    <br>
    <input type=submit value=Press> to upload the file!
    </form>
    </body>
    </html>
    Code:
    $param=param("upfile");
    system("cp $param /var/www/cgi-bin/Other/");
    But i couldn't copy the zipped file!!!

    How can i copy the file and unzip the directory?

    I don't want to use any modules!!!

    Regards
    Archana
    I know that you said you don't want to use any modules, but why, you already are? The param() function is part of the CGI module. If you aren't using the CGI module, then that function is useless to you, unless you have defined it yourself, somewhere else.

    As for the copy, unless the user specifies a directory with the file name, the file would have to be in the directory local to where the script is.

    Did you see any errors?

    Regards,

    Jeff

    Comment

    • KevinADC
      Recognized Expert Specialist
      • Jan 2007
      • 4092

      #3
      If you want to move a file from one directory to another you can use perls rename() function. See the rename() manpage for details. As far as unzipping the file I guess you can use whatever program the server has installed for that if you don't want to use a module. But thats not a perl question then.

      Comment

      Working...