i try to make system to upload multiple .txt file, when try to read the text file with fopen(), i keep getting same error.
Form :
<input type="file" name="file_input[]" id="file_input" multiple webkitdirectory="" directory="" mozdirectory="">
PHP :
$temp_file = array();
$total_file = count($_FILES["file_input"]["tmp_name"]);
for($x = 0; $x < $total_file; $x++){
$temp_file[$x] = $_FILES["file_input"]["tmp_name"][$x];
}
foreach ($temp_file as $loop){
$fp = fopen($loop, 'r');
}
The site keeps returning the error:
Warning: fopen(C:\WINDOWS\TEMP\php425.tmp) [function.fopen]: failed to open stream: No such file or directory in D:*****\AppServ\www*****\index.php on line 103
You need to add the path to the temporary file which will be upload_tmp_dir
parameter from php.ini
So add something like this
$path = ini_get('upload_tmp_dir');
foreach ($temp_file as $loop){
$fp = fopen($path . '/' . $loop, 'r');
}