Welcome to WebmasterWorld Guest from 184.73.13.66

Forum Moderators: open

Message Too Old, No Replies

Opera hangs when submitted POST form

Great in IE and Firefox

   
10:47 am on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



After clicking on submit, opera just hangs - no speed and time can go up to 4 min (like if it was parsing a file).
When typing the directly the url of the resutl page in Opera, it works fine.

It works great in IE and Firefox and I get the result page within a second.

Anyone knows why Opera do no respond to my simple form.
Opera 7.54 Win32 Windows XP

Thanks

10:55 am on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member kaled is a WebmasterWorld Top Contributor of All Time 10+ Year Member



If it's you own form, I suggest you split it into two, and move elements from one to the other until you identify the element that's causing the problem.

Kaled.

11:25 am on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I found the problem but I can't resolve it yet.
It is because my form had some input=file and it hangs in the resultpage (at the parsing stage) because Opera blank input have as a default value 'none'
Read : [webmasterworld.com...]

It not only hangs when the input file is blank but also when I type text in the input field which are non relevant (such as "derefere" or "deerel").

What should I do to check that the data entered in the input file are correct (such as "D:\images\try.jpg") and be sure that OPera doesn't hang when data are incorrect.

Thanks

12:49 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Please, I am stuck with Opera...

When leaving the field blank or typing wrong path or unrelevant text in the input file, Opera just hangs.

I have even put a exit(); statement on the first line of my result page (to force it to stop parsing) but it keeps hanging.

Furthermore, it even hangs when sending a .txt or .ini documents?

Spend the all day on Google doing search but found no solution.

Thank you

12:54 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member kaled is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Sounds like a behavioural anomaly in Opera coupled with a server-side script failure.

Since I have no knowledge of php (just perl) I can't help further with this problem.

Good luck,

Kaled.

1:18 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How about showing us the the relevant part of the processing script. Someone may be able to nail it down then.
1:57 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks a thousant for your help.
I have trim to show only the relevant part. I presume the error is in the form.

Just copy and paste and run it with Opera 7.54

If you leave the field blank, send a text file, ini file or type directly in the bar a wrong path or urelevant text, it should then hangs.


<?
//VARIABLE COMING FROM INCLUDE FILES
$width="765"; $bgcol="#a05552"; $eb3=""; $eb2=""; $switch="1"; $print="0"; $brk="";?>

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'><html><head><title>Try</title>
<style type="text/css">
<!--
* {margin : 0;}
body {width:765px; background-color:#a05552; margin-top:0; margin-left:auto; margin-right:auto; border:0 none inherit; text-align : center; font-family : arial, verdana, helvetica, sans-serif;}
p {color : #cccccc; font-size : 13px; font-family : arial; margin : 0; }
-->
</style></head>

<?
// ***************
// OTHER VARIABLES
// ***************
if(isset($_POST["preview"])) {$preview=$_POST["preview"];} else {$preview="none";}
// *********
// GD LIBRARY
// *********
$sizelimit = "42000";
$wlimit = "601";
$hlimit = "471";

//**********************
//FIRST PAGE LOAD - FORM
//**********************
if ($preview=="none") {echo "<p>Send your file</p>";
echo "<form method='post' action='load_try.php' enctype='multipart/form-data'>";
echo "<input type='file' name='imagefile' class='form1'>";
echo "<input name='preview' type='hidden' value='sendpic'>";
echo "&nbsp;&nbsp;&nbsp;<input type='submit' name='prev' value='PREVIEW' class='form1'></form>";
echo "</p>"; }

//+++++++++++++++
//***************
//SECOND PAGE LOAD
//***************
//+++++++++++++++
if($preview=="sendpic") {
echo "<p>";

$filename=$_FILES['imagefile']['tmp_name'];
$type = $_FILES['imagefile']['type'];
$size = $_FILES['imagefile']['size'];
$sizeb = @getimagesize($filename);
$widthp = $sizeb[0];
$height = $sizeb[1];
//****************
//CHECK FILE TYPE
//****************
if ($type!= "image/jpeg" AND $type!= "image/pjpeg") {
$preview = "error";
echo "<br>The format of the file (<b>".$_FILES['imagefile']['name']."</b>) is not recognized.<br>Make sure that your file is a <b>jpg/jpeg</b> format.<br>Please, submit a correct format.<br><br>"; }
//******************
//CHECK FILE SIZE KB
//******************
elseif ($size >= $sizelimit) {
$preview = "error";
echo "<br>The file you are submitting is too heavy (<b>".GetSize($size)."</b>).<br>Make sure the file is less than <b>".GetSize($sizelimit)."</b>.<br>Please, compress your picture and submit it again.<br><br>";}
//**********************************
//CHECK FILE SIZE (WIDTH and HEIGHT)
//**********************************
elseif ($widthp >= $wlimit $height >= $hlimit ) {
$preview = "error";
echo "<br>The file you are submitting is too large (<b>".$widthp."x".$height." px.</b>).<br>Make sure the file is not more than <b>".$wlimit."x".$hlimit."</b> px.<br>Please, reduce the size of your picture and submit it again.<br><br>";}

else {
$preview = "confpic";
//************
//COPY PICTURE
//************
echo "<br>OK PICTURE WILL BE COPIED AND THUMBNAIL GENERATED<br>"; }

echo "</p>";

//+++++++++++++++++++++++
//***********************
//RESUBMIT BECAUSE ERRORS
//***********************
//+++++++++++++++++++++++
if ($preview == "error") {
echo "<p>RE-Send your file</p>";
echo "<form method='post' action='load_try.php' enctype='multipart/form-data'>";
echo "<input type='file' name='imagefile' class='form1'>";
echo "<input name='preview' type='hidden' value='sendpic'>";
echo "&nbsp;&nbsp;&nbsp;<input type='submit' name='prev' value='PREVIEW' class='form1'></form>";
echo "</p>";
}

if($preview == "confpic") {
echo $brk;
echo "<br>OK PICTURE WILL BE COPIED AND THUMBNAIL GENERATED<br>";
} }

echo "</body></html>";

[edited by: tomda at 2:12 pm (utc) on Nov. 22, 2004]

2:11 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One thing I noticed is the lack of a MAX_FILE_SIZE field, which php.net says needs to be present and precede the file input.

if ($preview=="none") {echo "<p>Send your file</p>";
echo "<form method='post' action='load_try.php' enctype='multipart/form-data'>";
echo '<input type="hidden" name="MAX_FILE_SIZE" value="30000" />';
echo "<input type='file' name='imagefile' class='form1'>";
echo "<input name='preview' type='hidden' value='sendpic'>";
echo "&nbsp;&nbsp;&nbsp;<input type='submit' name='prev' value='PREVIEW' class='form1'></form>";
echo "</p>"; }

Try that and see what you get.

Regards

2:17 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Birdman,
Indeed, I forgot this one but it does not help.

Sorry, I forgot to mention for those who are ready to try the script that it should saved as 'load_try.php'.

2:39 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not sure if it's goint to help, but the last block of code isn't right.

else {
$preview = "confpic";
//************
//COPY PICTURE
//************
echo "<br>OK PICTURE WILL BE COPIED AND THUMBNAIL GENERATED<br>"; }

echo "</p>";

//+++++++++++++++++++++++
//***********************
//RESUBMIT BECAUSE ERRORS
//***********************
//+++++++++++++++++++++++
if ($preview == "error") {
echo "<p>RE-Send your file</p>";
echo "<form method='post' action='load_try.php' enctype='multipart/form-data'>";
echo "<input type='file' name='imagefile' class='form1'>";
echo "<input name='preview' type='hidden' value='sendpic'>";
echo "&nbsp;&nbsp;&nbsp;<input type='submit' name='prev' value='PREVIEW' class='form1'></form>";
echo "</p>";
}

if($preview == "confpic") {
echo $brk;
echo "<br>OK PICTURE WILL BE COPIED AND THUMBNAIL GENERATED<br>";
} }

That last two if($preview == ...) bits need to be outside of the the last else block. see, $preview will always == error in that block because you set it just after the else. I know that didn't make much sense :) Just try moving the last two if blocks outside of the last else.

else {
$preview = "confpic";
//************
//COPY PICTURE
//************
echo "<br>OK PICTURE WILL BE COPIED AND THUMBNAIL GENERATED<br>"; }

echo "</p>";

}

//+++++++++++++++++++++++
//***********************
//RESUBMIT BECAUSE ERRORS
//***********************
//+++++++++++++++++++++++
if ($preview == "error") {
echo "<p>RE-Send your file</p>";
echo "<form method='post' action='load_try.php' enctype='multipart/form-data'>";
echo "<input type='file' name='imagefile' class='form1'>";
echo "<input name='preview' type='hidden' value='sendpic'>";
echo "&nbsp;&nbsp;&nbsp;<input type='submit' name='prev' value='PREVIEW' class='form1'></form>";
echo "</p>";
}

if($preview == "confpic") {
echo $brk;
echo "<br>OK PICTURE WILL BE COPIED AND THUMBNAIL GENERATED<br>";
}

3:15 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for your remakr Birdman, sadly it will not resolve the problem I have with Opera.
BTW, did you try the script in Opera?

Nonetheless, I take note of your last remark.

3:34 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just tried it and it loads okay. There is another error though:

$widthp = $sizeb[0];
$height = $sizeb;

should be:

$widthp = $sizeb[0];
$height = $sizeb[1];

3:39 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You have tried and it load fine.
Which version of Opera do you have?
Did you tried to submit it with no value or with a .txt file?

This is strange!

Thanks for all your effort, btw
Hear from you tomorrow, going home now.

10:19 am on Nov 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know if it's of any help, but there is a known problem when submitting forms in Opera. This often happens when posting a comment on sites like A List Apart - it can hang for ages. It's not Opera's fault though, but the server's. It should be sending back a specific code, but a lot of servers don't send the correct code. Of course browsers like IE ignore the code, but Opera is much stricter. If all servers were configured properly, then this wouldn't happen. (Though I do wish Opera would allow for this situation as it makes itself look bad.)

I cannot confirm this is definitely the case, but I read about it once for sure.

3:22 pm on Nov 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



:LOL )
Thanks Hester.
This is the answer you just gave me at opera's forum.
Not much reply for the moment at opera's forum.

I have answered you

>> I don't know if it's of any help, but there is a known problem when submitting forms in Opera.

I am aware that they are known problem in form, especially with enctype='multipart/form-data due to security flaw. I know for example that when left blank, the value by default in Opera is 'none'

>> This often happens when posting a comment on sites like A List Apart - it can hang for ages. It's not Opera's fault though, but the server's.

I do not think that Opera hang due my server's fault. I presume it is really Opera which do not respond.

>> It should be sending back a specific code, but a lot of servers don't send the correct code.

Which code are talking about?