I'm trying to upload a file to my server or just open it and handle the contents but I get this strange error and I don't know why.
HTML form: http://pastebin.com/cSfMmvKF
php script: http://pastebin.com/fPzRVy5Y
If I try to test if the file is received I get a false response. Example:
if (isset($_FILES['epifile']))
echo 'Is set';
This evaluates as false. I'm pretty sure everything is quite correct so I have no idea where the error comes from. Can you guys help?
Edit: I'm running this with XAMPP on my own PC. Could it be some setting that I need to enable within Apache?
Your form must have an enctype="multipart/form-data" attribute.
Related
For some reasons I am getting parse error on the last line of the file even it is blank. I've used connect.php file as a connection file for putting the comment into the database. I'm using wampserver as a local server & coded all by myself
It must be some thing did not closed properly , like { or some line ending left post your php file for give proper solution
I had get an error when try creat new action for ethna framework.
I copy old action to new folder and rename all. (acction, template, UrlHandler) and it work in local (window, php 5.2).
But when i comit this source to linux server (php5.3). it not work.
i check log and get this error:
Ethna_Controller._trigger_WWW(/lib/Ethna/class/Ethna_Controller.php:875): undefined action [xxx_index] [ERROR CODE(32)]
i tried to echo action var in Ethna_Controller.php, line 918 ($action_obj =& $this->_getAction($action_name);), where alert this error, but nothing to show, i got empy page
So any worked with this framework, please help me!
Thank
Moving comment to answer to be accepted
Since you are telling that on your Windows server everything is working and moving to Linux it stops working, than it must be case-sensitiveness. Windows is case-insensitive (means Folder/MyClass and folder/myClass is equal and will not throw any error. Linux is case-sensitive (means Folder/MyClass and folder/myClass are not equal and path will be not found leading to error). Check if all your paths are in correct case.
I've some strange issues with some php code.
if ($user->userType=='admin'){
If I use the above command, the php engine just stop interpreting and display the code in plain text on my browser. On the other hand if I use the below method it works:
if ($user['userType']=='admin'){
Again here also:
$_SESSION['currentUser']->id
If I use the above code it just displays the rest of code as plain text:
id); // fail user }else{ $authentication="failed"; $noAuthPresentation="loginForm"; }
Why this is happening? It's a big project and I don't want to change every line where there is an occurrence of ->.
Do I need to change some setting somewhere? I'm using WAMP server with php 5.5.12.
Any help ? Thanks!
You're mixing up types, user is an array, and not an object. Something in your php config is doing something strange to your error display it seems. Right click on the page that has the errors, and view source if possible.
Does login.php contain html and php code by chance?
I got a file upload form using enctype=multipart/form-data, but my $_FILES array is always empty. max_upload_size is big enough (2MB, I'm testing with 100kb files). the exactly same code is working on other hosts, so I think something is wrong with my webhoster's php settings. does anyone know what I could check for? when I ask them they always tell me it can't be their fault -_-
EDIT:
You asked for code, I didn't post it because it's pretty complicated (a Shopware plugin), but I think I can extract the important parts:
HTML (Smarty):
<form method="post" action="{url action=saveRegister}" enctype="multipart/form-data">
PHP (inside my event handler):
file_put_contents('ul.log',serialize($_FILES));
Result (var_dumped unserialized):
array(0) {}
Full Form HTML: http://pastebin.com/Wq1yBTux
Found the error: some "security feature" of the framework "cleaned up" $_POST, so move_uploaded_file couldn't check if the file was uploaded correctly
Install Firebug (see network tab) or Livehttpheaders to see if your file is actually sent to the server and if the HTTP headers are correctly send by the browser.
They might be wrong for any reason (Content-Type not allowed, POST method not allowed)
It should give you data to look at and configuration parameters to check.
I'm working a web application with PHP.
Something wrong is happening that I have never seen before. $_GET is working well, but $_POST does not work exactly. Imagine the form below:
<form action="process.php" method="post">
<input type="text" name="title" />
<input type="submit" value="send" />
</form>
As you see, I've used post for method attribute of the form. In this case, the code below will return error:
<?php
$sentData = $_POST['title'];
echo($sentData);
?>
Error message:
PHP Notice: Undefined index: title in ...
But If I had used $_GET in php scripts and get in the html form codes, everything would work without any error.
There are something more strange.
There are just one form that returns no error while I'm using POST, other forms return error.
When I run this application locally (with Xampp - Apache 2.2) everything works fine without any error, but whenever I run the application an the remote server (IIS 7), I get these errors and problems.
so i would approach this in a couple of different ways:
#Dynamicus is correct, this is only a 'Notice' and not a fatal error (at least you didn't say so in the question), so this may be a difference in your .ini config or with a config definition to suppress errors like so 'error_reporting(0);'
You may want to make a back up of your current running .ini on your local and on the server and copy the working one over to your server and restart Apache and see if that makes a difference.
Why the indexed array (ie $_POST) is producing a warning is somewhat bizarre, but do a "print_r($_POST);" or a "var_dump($_POST);" to see the contents or if anything is off.
if you're using a framework or something that does routing, this could be something to look into.
i hope this helps and there are more settings for error reporting [here] http://php.net/manual/en/function.error-reporting.php
Your input element needs both a name and value property.
Finally I changed the server that my files were located on it. I tried them on another server (same OS), and everything worked fine.
I could not get what was the reason... This was the first time that I was getting this unknown error.
However, thank you all for your suggestions and comments.