enctype not working....

jaoaj

New Member
Messages
4
Reaction score
0
Points
0
even this simple code

Code:
<html>
<head>

<title>t</title>

</head>

<body>

<?php
	if(!isset($_POST["sub"]) or ($_POST["sub"]!="OK")){
?>
<form action="t.php" method="post" enctype="multipart/form-data">
<input type="file" name="f"><br>
<input type="Submit" name="sub" value="OK"></form>

<?php
	}else{
?>
OK1 
<?php
		echo "s=".$_FILES['f']['size'];
	}
?>


</body>
</html>


it show me the form, but when i submit it show error>
Code:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@<...>.x10hosting.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

when code dont have enctype...work fine but of course without image
 
Last edited:

jaoaj

New Member
Messages
4
Reaction score
0
Points
0
Read this page:
http://www.php.net/manual/en/language.operators.logical.php
then, when you understand why, change that "or" in your if-statement to "||".

you are not righ...
because c=(a or b) is same as c=(a || b) becouse of brackets

but...thats not problem....

even if i remove or-if i put only
Code:
<html>
<head>

<title>test</title>

</head>

<body>

<?php
	if(!isset($_POST["sub"])){
?>
<form action="t.php" method="post" enctype="multipart/form-data">
<input type="file" name="f"><br>
<input type="Submit" name="sub" value="OK"></form>

<?php
	}else{
?>
OK1 
<?php
		echo "v=".$_FILES['f']['size'];
	}
?>


</body>
</html>
still error-so it is not that error

even more-if i put this code>
Code:
<html>
<head>

<title>test</title>

</head>

<body>

<?php
	if(!isset($_POST["sub"])){
?>
<form action="t.php" method="post" enctype="multipart/form-data">
<input type="Submit" name="sub" value="OK"></form>

<?php
	}else{
?>
OK1 
<?php
	}
?>


</body>
</html>
error again...
 
Last edited:

marshian

New Member
Messages
526
Reaction score
9
Points
0
In that case, go to your cp and give us the details about those errors...
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
...no. he is right.... "||" is the proper way of saying "or" Check your PHP if/else logical operators documentation...
 

jaoaj

New Member
Messages
4
Reaction score
0
Points
0
all errors are like>
File does not exist: /home/.../public_html/500.shtml, referer: ..../t.php
File does not exist: /home/.../public_html/favicon.ico, referer: ..../t.php

only time is different (logical)
i never use favicon.ico or 500.shtml (i guess 500.shtml is for some error code-maybe http error 500 like http://www.checkupdown.com/status/E500.html ?)
Edit:
...no. he is right.... "||" is the proper way of saying "or" Check your PHP if/else logical operators documentation...

problem is not with "or" or "||" becouse its not logical problem-if i'm not right-it should show form again-not error!

and it work fine at my home
 
Last edited:

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
sry, but do you understand ANYTHING? are you saying that
Code:
IF (This OR This)

isnt logical? it is complete logic.....
 

jaoaj

New Member
Messages
4
Reaction score
0
Points
0
sry, but do you understand ANYTHING? are you saying that
Code:
IF (This OR This)

isnt logical? it is complete logic.....

no...
problem is not logical operators...
and (this or this) is same as (this || this) becouse of brackets, and of course it is logical

problem is with enctype-not with logical operators..
problem is form with enctype....WHY
 
Last edited:

marshian

New Member
Messages
526
Reaction score
9
Points
0
If all errors are 404's, then why is it complaining about a 500?
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
The server's giving a 500 error when he tries to upload, not a 404.

Anyway, this is rather strange, but I don't believe it has anything to do with the code. That has no flaws, and I've never known a php script to generate a 500 error under any circumstance. A misconfiged php.ini *might*, but I don't believe that's it either. I'm quite certain that this is an issue with the server. In testing the same script on several different servers, I only get this problem with my x10 one.

Unfortunately 500 errors are just about as vague as they come, so it's hard to say what's causing it. It could be any number of things. Someone with full access to the server would have to look into it. You could try bringing this up in the Free Hosting forum, or get a mod to move this topic there. Then it's just a matter of whether or not an admin will help you out :p
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
or you could hire a hacker to hack X10...and let them figure it out... :p jk
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
If you would hire a hacker to check it out, why wouldn't you just pay for your own server then?

In my opinion, it's best to ask x10 staff.
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
....did you even follow the rest of the topic? there is aparently a misconfigured php.ini file on X10'S SERVER!!! Thats why they need to know...wow.....
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
I did, but did you? I made the first response :p
But if you buy your own server, you can mess around with as much settings as you like, so no settings will ever be unchangable by yourself. As long as you can find them, of course...
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
.......aparently you dont get it.....
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
I don't get it either. What are we talking about now? :p

I only said it's *possible* that a misconfigured php.ini could cause a 500 error, but I wouldn't bet that that's the problem. A 500 is just too ambiguous. The code is definitely not causing it, though, so there's nothing any of us can do about it. It has to be a server admin that looks into it.
 

kkenny

Active Member
Messages
1,950
Reaction score
0
Points
36
Ehh.
What php version do you have? And what server might you be on?

I'm not entirely sure, but I think that Level 1 PHP doesn't allow you to execute this script. But then I'm not sure how the levels are set anyways.

But then if you say it's giving you a 500 error than it might be a problem with php.ini or... I'm not really sure but try to answer my questions in another post.
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
Would they really have the server set up to give a 500 error for something that's disabled? That seems like an odd and, in my mind, stupid idea. At the very least you'd imagine that they would have the cause entered in the error log.

But regardless, if that is the cause, then solution is easy -- upgrade to Intermediate ;-)
 
Top