Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file upload script to work

Status
Not open for further replies.

lmb5kids

Programmer
Dec 18, 2003
36
US
I am trying to get a upload script to work that uploads a file then emails the person the file is for to let them know they have a file. I am getting the 500 internal server error. I have read through the faq and tried what it said can anyone shed some light on this for me ? Thanks for your help.
 
hi,

one or two questions....

1. to clarify your intent ... I assume that you wish to upload a file to a webserver then send an email?

2. Can you add the following line to your code:

Code:
use CGI::Carp qw(fatalsToBrowser);

this should provide more details on the type of errors encountered.

3. can you post your code? (with ref to the FAQ?)

4. have you sufficient access priveleges to the webserver?


 
1. yes that is correct
2. I added the line and now have received this:
Error : Undefined subroutine &main::param called at (eval 1) line 51.

3. What part do you want to see ?
4. Yes, I can change permissions of files and dirs.
 
on point 2 ... have you added

use CGI;

... if not do this prior to

use CGI::Carp qw(fatalsToBrowser);
 
ok, now it is this :
Content-type: text/html
Software error:
Undefined subroutine &main::param called at /nfs/cust/3/54/36/263453/web/uploadfile/Upload.cgi line 32.
 
ok messed with it a little more and now I am getting this :
Error: cannot write to file /1.jpg: Permission denied.
 
are you trying to write to 1.jpg?

and if so where is 1.jpg located? ... I assume not in the root directory as pointed to by the error message ...

try checking permissions of 1.jpg and ensure you have the correct path to 1.jpg...
 
CGI code runs as the web server user. When a piece of CGI wants to write a file to disk it must have write permissions in the target directory. Your error message appears to indicate that the web server process does not have write permissions into the target directory.

Note: there are two FAQs in the Perl forum about uploading files via a web server. One is specifically about doing it with CGI.pm.

'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top