Reputation: 12111
I have a simple but annoying problem and I don't understand the reason. I need to upload a simple csv file with php. Here's my code:
index.php:
<form method="post" action="upload.php" enctype="multipart/form-data">
<input type="file" name="file" id="file" />
<input type="submit" value="submit" />
</form>
upload.php:
$upfile = "csv/".$_FILES["file"]["name"];
move_uploaded_file($_FILES["file"]["tmp_name"], $upfile);
No errors whatsoever, but the file is still not uploaded on the server.
UPDATE: print_r($_FILES) output:
Array ( [fileUpload] => Array ( [name] => file1.csv [type] => text/comma-separated-values [tmp_name] => /var/tmp/php6YZ4Bt [error] => 0 [size] => 45 ) )
Upvotes: 0
Views: 118
Reputation: 14406
Things to check
1) make sure your directory has permissions set to 755
2) check your path to see if it is correct.
3) make sure your post_max_size is the proper size.
4) make sure all your errors are turned on. This can be done in the php script by using this code:
error_reporting(E_ALL); // or E_STRICT
ini_set("display_errors",1);
5) Increase your memory limit to see if the script is using more memory than previously allocated..
ini_set("memory_limit","1024M");
Upvotes: 1