SitePoint Sponsor

User Tag List

Page 4 of 8 FirstFirst 12345678 LastLast
Results 76 to 100 of 181
  1. #76
    Alex Song
    SitePoint Community Guest
    I got the same error "Premature end of script headers" it turns out that the perl script shall not have space before each line.

  2. #77
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I pretty much just copied and pasted your code into Notepad and saved the files as instructed, then uploaded them to the correct locations and changed permissions. Trying it out, I get an internal server error. I checked my log, and it says "Premature end of script headers" What does that mean? I'm completely ignorant when it comes to Perl/CGI scripting.
    Did you upload the file in ASCII (text) format?

  3. #78
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Tainting error

    Great article!

    I do have two issues thus far though maybe someone can help me out with.
    The first issue occurs with the script ran as is, only changing the directory information. The file uploads into the specified directory but throws an internal server error stating that the file was not found.

    The second issue is running it -T where it throws a independency error. I get why it would do that but I am concerned about potential security risks involved not running the file in taint mode. I'm kind of wondering if I am being paranoid or if it is wise to untaint that data so it will run -T.

    Any thoughts, information, links, etc. will be extremely helpful and much appreciated!

    -Tina

  4. #79
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up One down!

    Fixed part one by removing the leading spaces from the code.

  5. #80
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by aezarien
    The second issue is running it -T where it throws a independency error. I get why it would do that but I am concerned about potential security risks involved not running the file in taint mode. I'm kind of wondering if I am being paranoid or if it is wise to untaint that data so it will run -T.
    -Tina
    I think it's probably failing the taint checking on the filename. If you replace:

    Code:
    $filename =~ s/.*[\/\\](.*)/$1/;
    with something like the more thorough:

    Code:
    $filename =~ /(\w+[\.\w]*)$/ or die ( "Filename was not in a recognized format." );
    $filename = $1;
    ...then that should untaint the filename (hopefully!).

    Cheers,
    Matt

  6. #81
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Spot on! Works like a charm. Thanks so much.

  7. #82
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Excellent

    Matt

  8. #83
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by elated
    Did you upload the file in ASCII (text) format?
    Yes

  9. #84
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am trying to install the script. I keep getting this error.. Any ideas? Thanks.



    Not Found
    The requested URL /cgi-bin/myupload.cgi was not found on this server.

    Apache/1.3.33 Server at powerpetshelp.com Port 80

  10. #85
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stevozip
    Yes
    Make sure there's no whitespace before the terminating END_HTML marker - the E must be the first character on the line.

    Make sure your path to Perl is correct, and that the script is executable by the webserver user.

    Also, take a look at your server's error log (or run the script with perl -c on the command line) to find out the exact error message.

    Matt

  11. #86
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ncentity
    I am trying to install the script. I keep getting this error.. Any ideas? Thanks.

    Not Found
    The requested URL /cgi-bin/myupload.cgi was not found on this server.

    Apache/1.3.33 Server at powerpetshelp.com Port 80
    It's telling you that it couldn't find the script at that URL. Make sure you uploaded the file to the correct place, and gave it the right name.

    Matt

  12. #87
    jo
    SitePoint Community Guest
    What I want to do is upload the image file and then also place the image name/path into a mySql database so that I can retrieve the path, place the name/path into a variable, and then use href and the variable to display the image. How can I do this?

    thx,

    jo

  13. #88
    SitePoint Member
    Join Date
    Dec 2004
    Location
    belmont
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Matt,

    I'm getting 0kb files created in the right location. I create a unique directory for a user with the permission set to 755. But when I check the error log, I see these error messages on the line where we read in the file handle:
    Code:
    while ( <$uploadfh> )
    Use of uninitialized value in <HANDLE>

    and

    readline() on unopened filehandle

    My version of CGI.pm is 3.04.

    Code:
    sub uploadFile
    {
        my $uname = shift;
        my $img_upload_dir = IMG_DIR;
    
        # 
        # upload image file
        #
        
        # get the file from the form
        my $query = new CGI;
        my $photo = $query->param("photo");
        $photo =~ s/.*[\/\\](.*)/$1/;
    
        if (defined $photo) {
    
    	# make a directory for the user
    	my $userdir = File::Spec->catdir($img_upload_dir, $uname);
    	unless (-d $userdir) {
    	    unless (mkdir($userdir, 0755)) {
    		return "Failed to create directory for user.";
    	    }
    	}
    	my $fullpath_file = File::Spec->catfile($userdir, $photo);
    	
    	# open the file and read from it and upload
    	my $uploadfh = $query->upload("photo");
    
    	open UPLOADFILE, ">$fullpath_file";
    	binmode UPLOADFILE;
    	while ( <$uploadfh> ) {
    	    print UPLOADFILE $buffer;
    	}
    	close UPLOADFILE;
        } else {
    	return "Fail";
        }
        return $photo;
    }
    Any ideas??

  14. #89
    SitePoint Member
    Join Date
    Dec 2004
    Location
    belmont
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oops, that $buffer wasn't suppose to be there. It's leftover from my trying to use read() instead of <$uploadfh>. In any case, the error still applies.

    Thanks!

  15. #90
    eweneek1
    SitePoint Community Guest
    Installed the upload.cgi, but I get an error message when I click on the uplooad file saying, "Can't find string terminator "END_HTML" anywhere before EOF at upload.cgi line 26".

  16. #91
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The upload cgi works great, but have questions.

    Question 1 - Is it possible to have two photo upload boxes on the form?

    Question 2 - Is there a way to be notified when someone uploads a photo without having to check every hour?

    Question 3 - Is there a way in the upload script to redirect to an existing webpage? Would the html code for the whole page need to be put in the script, or can it be done similar to a redirect in the formmail script I presently use?

    Where can I get information on how to do this?

  17. #92
    SitePoint Member
    Join Date
    Feb 2003
    Location
    California, USA
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi and thanks....

    I'm trying to get this to run for the first time on my ISP's Unix server, solaris server, on apache,. They say it's OK to run it. I have been getting ERROR 500 messages. When I run the upload.cgi script through the ISP's Perl Script Debugger, I get the exact same message as eweneek1. (see quote)

    As well, reading through all of the Forum posts, I took out all of the leading spaces in the script that may effect another previous issue.

    Thanks for your help, R.Andom

    Quote Originally Posted by eweneek1
    Installed the upload.cgi, but I get an error message when I click on the uplooad file saying, "Can't find string terminator "END_HTML" anywhere before EOF at upload.cgi line 26".

  18. #93
    SitePoint Member
    Join Date
    Feb 2003
    Location
    California, USA
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found a fix for the "Can't find string terminator "END_HTML"", problem on this archived page HERE.

    That fix gave me no syntax errors when I ran it through my ISP's Perl debugger.
    However I am still struggling w/ ERROR 500. This is the way we learn I guess.......

    I miss-stated the ISP server that the script is running on, and did not include Perl Ver. Should be:

    PERL version 4.01 built for sun4-solaris installed on our UNIX webservers.
    Could the Perl Version be causing the Problem? Thanks.......
    Last edited by R.Andom; Jan 15, 2006 at 15:43.

  19. #94
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by R.Andom
    I miss-stated the ISP server that the script is running on, and did not include Perl Ver. Should be:

    PERL version 4.01 built for sun4-solaris installed on our UNIX webservers.
    Could the Perl Version be causing the Problem? Thanks.......
    Probably. I wouldn't have thought CGI.pm would work with Perl versions earlier than 5. Perl 5 was released around 12 years ago!

    Matt

  20. #95
    SitePoint Member
    Join Date
    Feb 2003
    Location
    California, USA
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    RE: Photo/File Upload script

    HTML Code:
     	Quote: 												Originally Posted by R.Andom 				 I miss-stated the  ISP server that the script is running on, and did not include Perl Ver. Should be:
          
         PERL version 4.01 built for sun4-solaris installed on our UNIX webservers.
         Could the Perl Version be causing the Problem? Thanks....... 								
         
         Probably. I wouldn't have thought CGI.pm would work with Perl versions earlier than 5. Perl 5 was released around 12 years ago!
         
         Matt
    With that said.... A bit more info.... My ISP is one of the well known whose initials are EL. I have gotten many varying responses on the issue of what version of perl. From 5.004.04 to the latest of 4. It was &quot;heck&quot; getting them to inform me of absolute paths to use.

    What I am doing is trying to modify a cgi perl script which they offer to web hosting domain customers, which was originally written by Matt @ Matt's script site; wwwboard. I did that successfully Though I am a total perl newbie. I was able to to incorporate it into a CSS table-less layout to show the messages on the main page with formatting. looks good. BUT.... I don't like the photo part which requires that the image to be incorporated into the message by the writer, be on a server somewhere (though his use of an image in the &quot;new Message&quot; is cool). Most of my intended audience will not have that capability. SO.... My thought was to incorporate Your script in the place of the one included in Matts script. I have been trying to get your script to work stand-alone before trying to intergrate it in matts script. So now, up to speed.... His script is .pl and yours is .cgi and I'm told that should make no difference stand alone. So if the Host's info is correct perl ver 4, then that is the reason that the script will not work.

    QUESTION: If you are familiar with the wwwboard script, since it DOES WORK on my server as .pl, would my aim be achieved by simply changing the form elements in Matts script, to the form elements in your upload script? That would be easy. If not, is there another way to achieve my goal? I hope that this is clear. You can see the pages @

    www.random-specific.com/blog

    Thanks again...... R.Andom
    Last edited by R.Andom; Jan 17, 2006 at 11:51.

  21. #96
    SitePoint Member
    Join Date
    Feb 2003
    Location
    California, USA
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What it takes to make File Upload Work????.......

    Hi Matt and thanks for your earlier response....

    In reviewing all of the other threads on this topic poster throughout the entire forum (whew!!!!) it seems that this script dpends on CGI.pm. Is that true? I reviewed the info at:
    http://stein.cshl.org/WWW/software/CGI/ from an early post,
    and found that the current ver. is not ported to Sun Solaris if I am reading it correctly. Though it can be added if you do not have root access (Shared server/ ISP), if you are not on one of the "ported servers", no luck and no go.

    So..... Does this script depend on Modules to run? If so no amount of tweaking the script will make it work (as is) without the modules. Is this true?

    As a test I tried to run another script Upload Lite which supposedly needs Perl5 and it worked first time out!!!!! Less than 10 min. (Which means that the engineers at my ISP don't know which ver of perl is on the server!!! Make me CRAZY). As a Perl newbie I'm REALLY confused!!!!!! Help please?

    R.Andom

  22. #97
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, the upload script requires CGI.pm.

    Matt

  23. #98
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can't find string terminator

    Am having a bit of a mare trying to get this script to work :'( - I've followed everyone's advice and posts here, and have managed to get to a point where the 500 error message is saying:

    Can't find string terminator "END_HTML" anywhere before EOF at line 25

    I've read the link from R.Andom's post saying he had a fix for this error and unfortunately this does not make much sense to me!

    Can anyone explain to me what I need to do to fix this error?

    Thanks for your help,
    Tony

  24. #99
    JohnSmith
    SitePoint Community Guest
    I get the same error as HELPTony

  25. #100
    malahierba
    SitePoint Community Guest
    I have one problem...when i receive the email, i just receive the name of the file but not the file...thanks malahierb@gmail.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •