By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,710 Members | 1,970 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,710 IT Pros & Developers. It's quick & easy.

How to copy file from one source to other source?

P: 79

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:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <form method='POST' enctype='multipart/form-data' action='/cgi-bin/'>
  5. File to upload: <input type=file name=upfile><br>
  6. Notes about the file: <input type=text name=note><br>
  7. <br>
  8. <input type=submit value=Press> to upload the file!
  9. </form>
  10. </body>
  11. </html>
Expand|Select|Wrap|Line Numbers
  2. $param=param("upfile");
  3. 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!!!

Jan 30 '09 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 2.5K+
P: 3,503
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?


Jan 30 '09 #2

Expert 2.5K+
P: 4,059
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.
Jan 30 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.