Hey people i got a question where im seriously stuck with.
I got a php file which reads .csv files and writes it to the database. When i run it locally it works perfectly (with a standard xampp installation). However my problem is, when i put the exact same script on the webserver it cant find the file anymore (even tthough i point to it through the form)
Ik heb een php bestand die dus csv inleest en dit naar een database schrijft. Lokaal werkt dit helemaal 100% perfect (via xampp). Heres a small part of the code:
the form:
<?php
<table >
<form name="form" method="post" action=' . $_SERVER['PHP_SELF'] . '"">
<tr><td>Bestand: </td><td><input type="file" name="bestand"></td></tr>
<tr><td>knop</td><td><input type="submit" value="upload" name="eenValue"/></td></tr>
</table></form>';
?>
What it does is as soon as you submit the form it does php_self and the variable eenValue becomes upload. With this value it goes into the correct case where it does the following:
<?php
case 'upload':
if (!file_exists($_POST['bestand'])) {
echo "Bestand niet gevonden. \n";
//this means file not found.
} else {
insertFile();
}
break;
?>
what happens is is that i keep getting the 'file not found' error.. which is weird (in my opinion) cause locally Everything works but as soon as its on the webserver i get this.
So anyone have any suggestions? im seriously stuck here and have no clue whatsoever on how to fix it. Thanks in advance :)
edit: Is it possible that its the settings in php.ini somehow and ifso.. what needs to be changed? I havent made any changes to php.ini locally so mayb the host has done something?
Upload file error.
Started by bleastan, Jul 19 2010 01:43 AM
2 replies to this topic
#1
Posted 19 July 2010 - 01:43 AM
|
|
|
#2
Posted 19 July 2010 - 01:59 AM
the form needs to be typed as multipart, like this:
<form action="file.php" method="post" enctype="multipart/form-data">
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#3
Posted 19 July 2010 - 11:28 PM
Thanks alot problem solved (also used the $_File global, didnt know that one existed :P)


Sign In
Create Account


Back to top









