FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » different servers, different results with a file upload
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
different servers, different results with a file upload [message #175190] Sun, 21 August 2011 16:11 Go to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
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
Re: different servers, different results with a file upload [message #175191 is a reply to message #175190] Sun, 21 August 2011 16:18 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
BTW: the upload file size is 28K
bill
Re: different servers, different results with a file upload [message #175192 is a reply to message #175190] Sun, 21 August 2011 16:24 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
upload_max_file_size is 2M
post_max_size is 8M

bill
Re: different servers, different results with a file upload [message #175195 is a reply to message #175190] Sun, 21 August 2011 19:52 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
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(at)attglobal(dot)net
==================
Re: different servers, different results with a file upload [message #175196 is a reply to message #175190] Sun, 21 August 2011 20:06 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
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(at)attglobal(dot)net
==================
Re: different servers, different results with a file upload [message #175197 is a reply to message #175195] Sun, 21 August 2011 21:18 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
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
..
Re: different servers, different results with a file upload [message #175198 is a reply to message #175197] Sun, 21 August 2011 22:10 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
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(at)attglobal(dot)net
==================
Re: different servers, different results with a file upload [message #175203 is a reply to message #175197] Mon, 22 August 2011 08:32 Go to previous messageGo to next message
Gregor Kofler is currently offline  Gregor Kofler
Messages: 69
Registered: September 2010
Karma: 0
Member
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
Re: different servers, different results with a file upload [message #175207 is a reply to message #175190] Mon, 22 August 2011 14:13 Go to previous messageGo to next message
Twayne is currently offline  Twayne
Messages: 135
Registered: September 2010
Karma: 0
Senior Member
In news:Lv2dnVLhHazLs8zTnZ2dnUVZ_sednZ2d(at)cablespeedmi(dot)com,
bill <nobody(at)spamcop(dot)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.
Re: different servers, different results with a file upload [message #175208 is a reply to message #175207] Tue, 23 August 2011 11:45 Go to previous message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
On 8/22/2011 10:13 AM, Twayne wrote:
> In news:Lv2dnVLhHazLs8zTnZ2dnUVZ_sednZ2d(at)cablespeedmi(dot)com,
> bill<nobody(at)spamcop(dot)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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Roll SQL name value query into two-dimensional array
Next Topic: strtotime
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 02:32:35 GMT 2024

Total time taken to generate the page: 0.03308 seconds