Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #2927 > unrolled thread

different servers, different results with a file upload

Started bybill <nobody@spamcop.net>
First post2011-08-21 12:11 -0400
Last post2011-08-23 07:45 -0400
Articles 10 — 4 participants

Back to article view | Back to comp.lang.php


Contents

  different servers, different results with a file upload bill <nobody@spamcop.net> - 2011-08-21 12:11 -0400
    Re: different servers, different results with a file upload bill <nobody@spamcop.net> - 2011-08-21 12:18 -0400
    Re: different servers, different results with a file upload bill <nobody@spamcop.net> - 2011-08-21 12:24 -0400
    Re: different servers, different results with a file upload Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-21 15:52 -0400
      Re: different servers, different results with a file upload bill <nobody@spamcop.net> - 2011-08-21 17:18 -0400
        Re: different servers, different results with a file upload Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-21 18:10 -0400
        Re: different servers, different results with a file upload Gregor Kofler <usenet@gregorkofler.com> - 2011-08-22 10:32 +0200
    Re: different servers, different results with a file upload Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-21 16:06 -0400
    Re: different servers, different results with a file upload "Twayne" <nobody@devnull.spamcop.net> - 2011-08-22 10:13 -0400
      Re: different servers, different results with a file upload bill <nobody@spamcop.net> - 2011-08-23 07:45 -0400

#2927 — different servers, different results with a file upload

Frombill <nobody@spamcop.net>
Date2011-08-21 12:11 -0400
Subjectdifferent servers, different results with a file upload
Message-ID<Lv2dnVLhHazLs8zTnZ2dnUVZ_sednZ2d@cablespeedmi.com>
I have a small script that works fine on the development server, 
but when I try to run it for real on the production server it 
does not work.

here is the html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<title>CaseNoteCheck</title>
</head>
<body>

<h2>Case Note Edit Checker</h2>
<form action="caseNoteChecker.php" method="POST" 
enctype="multipart/form-data" >
<input type="hidden" name="MAX_FILE_SIZE" value="40000" />
<input type="file" name="caseNote"/>
<input type="submit"/>
</form>

</body>
</html>

here is the top of the php script:
<?php
//caseNoteChecker.php receives file from CaseNoteChecker.html

session_start ();
error_reporting(E_ALL);

$_SESSION ['current_user'] = "WPD";


echo "<pre>";
print_r($_POST);
print_r($_FILES);
echo "</pre>";

On the development server the file uploads correctly and all is 
well. On the production server the $_FILE array is empty.

Array
(
     [caseNote] => WPD-CaseNotes.txt
)
Array
(
)

and naturally it fails.

I searched with google and found a terrific article by jkorpela, 
but afak I am doing it right.

Suggestions to debug this please.  It must be a server 
configuration issue but I don't know where to look.

bill

[toc] | [next] | [standalone]


#2928

Frombill <nobody@spamcop.net>
Date2011-08-21 12:18 -0400
Message-ID<EpadnXXuCbh5sszTnZ2dnUVZ_sKdnZ2d@cablespeedmi.com>
In reply to#2927
BTW: the upload file size is 28K
bill

[toc] | [prev] | [next] | [standalone]


#2929

Frombill <nobody@spamcop.net>
Date2011-08-21 12:24 -0400
Message-ID<k7CdnflB6vj1rMzTnZ2dnUVZ_vqdnZ2d@cablespeedmi.com>
In reply to#2927
upload_max_file_size is 2M
post_max_size is 8M

bill

[toc] | [prev] | [next] | [standalone]


#2933

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-08-21 15:52 -0400
Message-ID<j2rnmq$k5j$1@dont-email.me>
In reply to#2927
On 8/21/2011 12:11 PM, bill wrote:
> I have a small script that works fine on the development server, but
> when I try to run it for real on the production server it does not work.
>
> here is the html:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
>
> <html>
> <head>
> <title>CaseNoteCheck</title>
> </head>
> <body>
>
> <h2>Case Note Edit Checker</h2>
> <form action="caseNoteChecker.php" method="POST"
> enctype="multipart/form-data" >
> <input type="hidden" name="MAX_FILE_SIZE" value="40000" />
> <input type="file" name="caseNote"/>
> <input type="submit"/>
> </form>
>
> </body>
> </html>
>
> here is the top of the php script:
> <?php
> //caseNoteChecker.php receives file from CaseNoteChecker.html
>
> session_start ();
> error_reporting(E_ALL);
>
> $_SESSION ['current_user'] = "WPD";
>
>
> echo "<pre>";
> print_r($_POST);
> print_r($_FILES);
> echo "</pre>";
>
> On the development server the file uploads correctly and all is well. On
> the production server the $_FILE array is empty.
>
> Array
> (
> [caseNote] => WPD-CaseNotes.txt
> )
> Array
> (
> )
>
> and naturally it fails.
>
> I searched with google and found a terrific article by jkorpela, but
> afak I am doing it right.
>
> Suggestions to debug this please. It must be a server configuration
> issue but I don't know where to look.
>
> bill

The fact the $_POST array is empty means PHP isn't getting the 
information from the web server.

First thing to check on things like this is your HTML - is it valid?

Next would be differences between the two web servers.


-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#2935

Frombill <nobody@spamcop.net>
Date2011-08-21 17:18 -0400
Message-ID<bIqdnRCPZMam68zTnZ2dnUVZ_gydnZ2d@cablespeedmi.com>
In reply to#2933
On 8/21/2011 3:52 PM, Jerry Stuckle wrote:
> On 8/21/2011 12:11 PM, bill wrote:
>> I have a small script that works fine on the development
>> server, but
>> when I try to run it for real on the production server it does
>> not work.
>>
>> here is the html:
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
>> "http://www.w3.org/TR/html4/strict.dtd">
>>
>> <html>
>> <head>
>> <title>CaseNoteCheck</title>
>> </head>
>> <body>
>>
>> <h2>Case Note Edit Checker</h2>
>> <form action="caseNoteChecker.php" method="POST"
>> enctype="multipart/form-data" >
>> <input type="hidden" name="MAX_FILE_SIZE" value="40000" />
>> <input type="file" name="caseNote"/>
>> <input type="submit"/>
>> </form>
>>
>> </body>
>> </html>
>>
>> here is the top of the php script:
>> <?php
>> //caseNoteChecker.php receives file from CaseNoteChecker.html
>>
>> session_start ();
>> error_reporting(E_ALL);
>>
>> $_SESSION ['current_user'] = "WPD";
>>
>>
>> echo "<pre>";
>> print_r($_POST);
>> print_r($_FILES);
>> echo "</pre>";
>>
>> On the development server the file uploads correctly and all is
>> well. On
>> the production server the $_FILE array is empty.
>>
>> Array
>> (
>> [caseNote] => WPD-CaseNotes.txt
>> )
>> Array
>> (
>> )
>>
>> and naturally it fails.
>>
>> I searched with google and found a terrific article by
>> jkorpela, but
>> afak I am doing it right.
>>
>> Suggestions to debug this please. It must be a server
>> configuration
>> issue but I don't know where to look.
>>
>> bill
>
> The fact the $_POST array is empty means PHP isn't getting the
> information from the web server.
>
> First thing to check on things like this is your HTML - is it valid?

"Well it looked valid"
However the W3C validator wanted the form contents in a <div> so 
I did that and now it works.

Thanks Jerry

Another question:  I write a lot of program fragments that are 
loaded via AJAX into a huge application.  I obviously can't 
validate them by submitting them to the W3C markup validation 
service, does anyone have suggestions on how to validate the 
fragments ?

bill
.

[toc] | [prev] | [next] | [standalone]


#2936

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-08-21 18:10 -0400
Message-ID<j2rvo0$9kp$1@dont-email.me>
In reply to#2935
On 8/21/2011 5:18 PM, bill wrote:
> On 8/21/2011 3:52 PM, Jerry Stuckle wrote:
>> On 8/21/2011 12:11 PM, bill wrote:
>>> I have a small script that works fine on the development
>>> server, but
>>> when I try to run it for real on the production server it does
>>> not work.
>>>
>>> here is the html:
>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
>>> "http://www.w3.org/TR/html4/strict.dtd">
>>>
>>> <html>
>>> <head>
>>> <title>CaseNoteCheck</title>
>>> </head>
>>> <body>
>>>
>>> <h2>Case Note Edit Checker</h2>
>>> <form action="caseNoteChecker.php" method="POST"
>>> enctype="multipart/form-data" >
>>> <input type="hidden" name="MAX_FILE_SIZE" value="40000" />
>>> <input type="file" name="caseNote"/>
>>> <input type="submit"/>
>>> </form>
>>>
>>> </body>
>>> </html>
>>>
>>> here is the top of the php script:
>>> <?php
>>> //caseNoteChecker.php receives file from CaseNoteChecker.html
>>>
>>> session_start ();
>>> error_reporting(E_ALL);
>>>
>>> $_SESSION ['current_user'] = "WPD";
>>>
>>>
>>> echo "<pre>";
>>> print_r($_POST);
>>> print_r($_FILES);
>>> echo "</pre>";
>>>
>>> On the development server the file uploads correctly and all is
>>> well. On
>>> the production server the $_FILE array is empty.
>>>
>>> Array
>>> (
>>> [caseNote] => WPD-CaseNotes.txt
>>> )
>>> Array
>>> (
>>> )
>>>
>>> and naturally it fails.
>>>
>>> I searched with google and found a terrific article by
>>> jkorpela, but
>>> afak I am doing it right.
>>>
>>> Suggestions to debug this please. It must be a server
>>> configuration
>>> issue but I don't know where to look.
>>>
>>> bill
>>
>> The fact the $_POST array is empty means PHP isn't getting the
>> information from the web server.
>>
>> First thing to check on things like this is your HTML - is it valid?
>
> "Well it looked valid"
> However the W3C validator wanted the form contents in a <div> so I did
> that and now it works.
>
> Thanks Jerry
>
> Another question: I write a lot of program fragments that are loaded via
> AJAX into a huge application. I obviously can't validate them by
> submitting them to the W3C markup validation service, does anyone have
> suggestions on how to validate the fragments ?
>
> bill
> .

Try an HTML newsgroup.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#2942

FromGregor Kofler <usenet@gregorkofler.com>
Date2011-08-22 10:32 +0200
Message-ID<j2t46u$sqg$1@dont-email.me>
In reply to#2935
Am 2011-08-21 23:18, bill meinte:

> Another question:  I write a lot of program fragments that are loaded
> via AJAX into a huge application.  I obviously can't validate them by
> submitting them to the W3C markup validation service, does anyone have
> suggestions on how to validate the fragments ?

Write it properly in the first place. Generating valid markup is not
*that* difficult. Validating a fragment is futile anyway, since it lacks
information about document type, encoding, surrounding markup etc.

Besides, I suppose you are injecting your XHR delivered markup by
setting the innerHTML property, which is proprietary and on some
browsers laden with problems.

Both topics are better discussed in c.i.w.a.html and c.l.javascript
respectively.

Gregor


-- 
http://vxweb.net

[toc] | [prev] | [next] | [standalone]


#2934

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-08-21 16:06 -0400
Message-ID<j2rogp$pjj$1@dont-email.me>
In reply to#2927
On 8/21/2011 12:11 PM, bill wrote:
> I have a small script that works fine on the development server, but
> when I try to run it for real on the production server it does not work.
>
> here is the html:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
>
> <html>
> <head>
> <title>CaseNoteCheck</title>
> </head>
> <body>
>
> <h2>Case Note Edit Checker</h2>
> <form action="caseNoteChecker.php" method="POST"
> enctype="multipart/form-data" >
> <input type="hidden" name="MAX_FILE_SIZE" value="40000" />
> <input type="file" name="caseNote"/>
> <input type="submit"/>
> </form>
>
> </body>
> </html>
>
> here is the top of the php script:
> <?php
> //caseNoteChecker.php receives file from CaseNoteChecker.html
>
> session_start ();
> error_reporting(E_ALL);
>
> $_SESSION ['current_user'] = "WPD";
>
>
> echo "<pre>";
> print_r($_POST);
> print_r($_FILES);
> echo "</pre>";
>
> On the development server the file uploads correctly and all is well. On
> the production server the $_FILE array is empty.
>
> Array
> (
> [caseNote] => WPD-CaseNotes.txt
> )
> Array
> (
> )
>
> and naturally it fails.
>
> I searched with google and found a terrific article by jkorpela, but
> afak I am doing it right.
>
> Suggestions to debug this please. It must be a server configuration
> issue but I don't know where to look.
>
> bill

Sorry - sent before I meant to

If all these fail, the next thing to check would be differences in PHP 
version on the two systems.  I haven't seen any problem with $_POST in 
PHP, but that doesn't mean it doesn't exist.

The other thing you might want to do is add display_errors=on to your 
script.  But your problem here is the $_POST initialization is long 
before you get to any code in your script, so if there is an error in 
setting up $_POST, you'll never see it.  In such cases it's better to 
place the values in your httpd.conf file (if you're using Apache).  See 
http://www.php.net/manual/en/configuration.changes.php for more 
information on how to do this.

NOW I think I'm done :)
-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#2947

From"Twayne" <nobody@devnull.spamcop.net>
Date2011-08-22 10:13 -0400
Message-ID<j2to6k$jlp$1@dont-email.me>
In reply to#2927
In news:Lv2dnVLhHazLs8zTnZ2dnUVZ_sednZ2d@cablespeedmi.com,
bill <nobody@spamcop.net> typed:
> I have a small script that works fine on the development
> server, but when I try to run it for real on the
> production server it does not work.
>
> here is the html:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
>  "http://www.w3.org/TR/html4/strict.dtd">
>
> <html>
> <head>
> <title>CaseNoteCheck</title>
> </head>
> <body>
>
> <h2>Case Note Edit Checker</h2>
> <form action="caseNoteChecker.php" method="POST"
> enctype="multipart/form-data" >
> <input type="hidden" name="MAX_FILE_SIZE" value="40000" />
> <input type="file" name="caseNote"/>
> <input type="submit"/>
> </form>
>
> </body>
> </html>
>
> here is the top of the php script:
> <?php
> //caseNoteChecker.php receives file from
> CaseNoteChecker.html
> session_start ();
> error_reporting(E_ALL);
>
> $_SESSION ['current_user'] = "WPD";
>
>
> echo "<pre>";
> print_r($_POST);
> print_r($_FILES);
> echo "</pre>";
>
> On the development server the file uploads correctly and
> all is well. On the production server the $_FILE array is
> empty.
> Array
> (
>     [caseNote] => WPD-CaseNotes.txt
> )
> Array
> (
> )
>
> and naturally it fails.
>
> I searched with google and found a terrific article by
> jkorpela, but afak I am doing it right.
>
> Suggestions to debug this please.  It must be a server
> configuration issue but I don't know where to look.
>
> bill

Are the server PHP versions the same? Deprecated or "improved" features can
cause a lot of problems.


[toc] | [prev] | [next] | [standalone]


#2949

Frombill <nobody@spamcop.net>
Date2011-08-23 07:45 -0400
Message-ID<ybGdnSgx1I93D87TnZ2dnUVZ_uSdnZ2d@cablespeedmi.com>
In reply to#2947
On 8/22/2011 10:13 AM, Twayne wrote:
> In news:Lv2dnVLhHazLs8zTnZ2dnUVZ_sednZ2d@cablespeedmi.com,
> bill<nobody@spamcop.net>  typed:
>> I have a small script that works fine on the development
>> server, but when I try to run it for real on the
>> production server it does not work.
>>
>> here is the html:
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
>>   "http://www.w3.org/TR/html4/strict.dtd">
>>
>> <html>
>> <head>
>> <title>CaseNoteCheck</title>
>> </head>
>> <body>
>>
>> <h2>Case Note Edit Checker</h2>
>> <form action="caseNoteChecker.php" method="POST"
>> enctype="multipart/form-data">
>> <input type="hidden" name="MAX_FILE_SIZE" value="40000" />
>> <input type="file" name="caseNote"/>
>> <input type="submit"/>
>> </form>
>>
>> </body>
>> </html>
>>
>> here is the top of the php script:
>> <?php
>> //caseNoteChecker.php receives file from
>> CaseNoteChecker.html
>> session_start ();
>> error_reporting(E_ALL);
>>
>> $_SESSION ['current_user'] = "WPD";
>>
>>
>> echo "<pre>";
>> print_r($_POST);
>> print_r($_FILES);
>> echo "</pre>";
>>
>> On the development server the file uploads correctly and
>> all is well. On the production server the $_FILE array is
>> empty.
>> Array
>> (
>>      [caseNote] =>  WPD-CaseNotes.txt
>> )
>> Array
>> (
>> )
>>
>> and naturally it fails.
>>
>> I searched with google and found a terrific article by
>> jkorpela, but afak I am doing it right.
>>
>> Suggestions to debug this please.  It must be a server
>> configuration issue but I don't know where to look.
>>
>> bill
>
> Are the server PHP versions the same? Deprecated or "improved" features can
> cause a lot of problems.
>
>
>
Yes they are.  Still no clue why "identical" servers would behave 
differently, but cleaning up the html (thanks Jerry) fixed that 
problem.

bill

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web