Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Perl CGI File Upload Problem

by davido (Cardinal)
on Jun 17, 2011 at 16:12 UTC ( [id://910200]=note: print w/replies, xml ) Need Help??


in reply to Perl CGI File Upload Problem

Is it your server that disallows POST, or is your CGI.pm configured to disallow uploads? If it's the server at issue, you're going to have to either find a different service provider or give up on uploads. GET uses the URI, which isn't going to work out.

It actually doesn't look like you're using CGI.pm. You should be. Whether you're new, or a seasoned pro with Perl, there is almost no good reason to not use CGI.pm, or one of its siblings such as CGI::Simple. But whichever module you use, you may find it necessary to explicitly allow uploads. Of particular interest will be the $CGI::POST_MAX and $CGI::DISABLE_UPLOADS flags.


Dave

Replies are listed 'Best First'.
Re^2: Perl CGI File Upload Problem
by nikhgeo (Initiate) on Jun 19, 2011 at 16:59 UTC

    As I have mentioned in my post, I'm using the tutorial given at http://www.sitepoint.com/uploading-files-cgi-perl-2/ for the Perl script. So I guess I'm using the CGI.pm module

    "But whichever module you use, you may find it necessary to explicitly allow uploads"

    Not sure about how to do that, but there is nothing said about that in the tutorial

    When I use the POST method, its giving an error " the requested method POST is not allowed for the url .."

      That is an Apache message (not CGI, not Perl). It occurs when you specify an HTML document as the action of a form (as opposed to a CGI script, for example), or when the webserver isn't set to recognize your script as executable (thus it treats it as a document, and you can't POST to a document).

      Within the form, the "action" should be the url of the script, not of another HTML document. If you already have it set as such, there may be a misconfiguration in Apache where it recognizes the script as a document rather than an executable program.

      See the following link: Why do I keep getting "Method Not Allowed" for form POST requests? (From the Apache FAQ).


      Dave

        "Within the form, the "action" should be the url of the script, not of another HTML document."

        I have used fileprocess.cgi script as the action for the form

        "there may be a misconfiguration in Apache where it recognizes the script as a document rather than an executable program"

        But when I use GET method, I'm able to create an empty file in the same name as the local file selected in the server

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://910200]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-03-28 15:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found