Posted on 2006-04-19
Last Modified: 2013-12-25
my html file contains
<input type=\"file\" name=\"file\" />

inmy cgi, i do
$query = new CGI;
$w = $query->param('file');
print "file: $w";

instead of printing "file: C:\test"  it is only printing "file: test"
Question by:perlperl

    Author Comment

    if the file is c:\test\eval.doc
    then it only prints eval.doc
    it is not printing complete path

    Author Comment

    strange if i run on host A where apache is installed, i have thi sissue, but when i run on different host B, it prints complete path.....

    Author Comment

    this is something i found out

    if i write c:\test\eval.doc  then it prints evail.doc
    if i give  :\test\eval.doc  then it prints ":\test\eval.doc"
    it does not like if there is c: or d:  why??

    Author Comment

    1 more thing i tried

    <input type=text name=user size=20/>
    <input type="file" name="filename" />

    in CGI
    $query = new CGI;
    $w = $query->param('filename');
    $n  = $query->param('user');
    print "file: $w , size = $s <br>";
    print "name: $n <br>";
    exit 0;

    if i give "C:\test" for user, it prints "c:\user"
    but if i give "c:\test\eval.doc" for file, it only prints eval.doc

    Author Comment

    i tried using get to see what the form is sending....
    on the url i saw

    which means the form itself is not sending the complete path................
    LVL 51

    Accepted Solution

    check your browser, not a web server or CGI problem

    Author Comment

    well, it worked after adding these two lines

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
    Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
    Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now