Tuesday 15 March 2011

PHP reading uploaded file after post -



PHP reading uploaded file after post -

php reading uploaded file content issue

i upload txt file, , did following

print_r($_files);

the output was

array ( [up_file] => array ( [name] => upload.txt [type] => text/plain [tmp_name] => /tmp/phpbyrywn [error] => 0 [size] => 26 ) )

when did following

$tmp_file_path = strtolower($_files['up_file']['tmp_name']); //rename file $file_content = file_get_contents($tmp_file_path);

the $tmp_file_path homecoming me /tmp/phpbyrywn $file_content homecoming nothing, went root via ssh , check /tmp did not see file name /tmp/phpbyrywn , should resolve this.

should state default directory uploaded file in part of code or ?

your file scheme seem case-sensitive,

and seek read lower-cased file name.

try without strtolower:

<?php $tmp_file_path = $_files['up_file']['tmp_name']; $file_content = file_get_contents($tmp_file_path);

php

No comments:

Post a Comment