CGI Script (Upload) not working ...

 
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI
View previous topic :: View next topic  
Author Message
718aba
-


Joined: 17 Jun 2005
Posts: 1

PostPosted: Fri Jun 17, 2005 3:12 pm    Post subject: CGI Script (Upload) not working ... Reply with quote

Hi!

I tried to enable uploading to the web server with the following script, I've found on the Net (modifying some variables) (I do not have experiences with cgi!). It seemed to work, the 'Thanks' page appears, but the file was not uploaded. Someone can help me to find the problem? (The cgi-log does not show anyting). The '/perl' path points to the Perl installation root path, not the 'bin' path.

[Script]

#!/perl
use CGI;
$upload_dir = "/upload";
$query = new CGI;
$filename = $query->param("fname");
$filename =~ s/.*[\/\\](.*)/$1/;
$upload_filehandle = $query->upload("fname");
open UPLOADFILE, ">$upload_dir/$filename";
# binmode UPLOADFILE;
while ( <$upload_filehandle> )
{
print UPLOADFILE;
}
close UPLOADFILE;

print $query->header ( );
print <<"(FIM)";

<HTML>
<HEAD>
<TITLE>Thanks!</TITLE>
</HEAD>

<BODY>

<P>Thanks for uploading the file!</P>

</BODY>
</HTML>
(FIM)

[End of Script]

Thank you
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sat Jun 18, 2005 11:34 am    Post subject: Re: CGI Script (Upload) not working ... Reply with quote

718aba,

The variable $upload_dir
Code:

 $upload_dir = "/upload";


should be set to an existent full path on your hard drive. /upload is not a good path if you're on Windows and does not exist if you're on another operating system. Set it for example to "c:\\upload" (note the double \).

[code]
# binmode UPLOADFILE;
[code]
should be uncommented (remove #).

If it is still not working please send the script and your abyss.conf file to support@aprelium.com . Do not forget to add a reference to this forum message.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group