Uploading Files Using CGI and Perl (3)
Final Step: Putting It All Together and Test it
1. Place the Files on your Server
Place the HTML form somewhere under your Website's document root, and your CGI script in your Website's cgi-bin directory.
Note: don't forget to make the CGI script executable if you're on a UNIX server - chmod a+rx upload.cgi or chmod 755 upload.cgi
2. Set the Correct Paths and URLs
If necessary, change the "upload.cgi" URL in the <FORM> tag to point to the correct URL for the CGI script:
<FORM ACTION="/cgi-bin/upload.cgi" METHOD="post" ENCTYPE="multipart/form-data">
Also, don't forget to set the correct path to Perl in your CGI script, and the correct absolute path to the 'upload' directory that you created on your server:
#!/usr/bin/perl -w $upload_dir = "/home/mywebsite/htdocs/upload";
3. Test the Script