我收到以下错误:
调用未定义函数 convertTextFile()
我如何调用该特定功能?
这是我的代码:
public function post_files()
{
// $file = Input::file('file'); // your file upload input field in the form should be named 'file'
$allowedExts = array("gif", "jpeg", "jpg","htm","html", "ppt","pptx","png","txt","pdf","doc","rtf","docx","xls","xlsx","bmp");
if(isset($_FILES['image']['tmp_name']))
{
$i=0;
foreach(Input::file('image') as $key => $file)
{
$temp = explode(".", $_FILES["image"]["name"][$i]);
$extension = end($temp);
$filename= $temp[0];
$destinationPath = 'upload/'.$filename.'.'.$extension;
$name=$filename.'.'.$extension;
if(in_array($extension, $allowedExts))
{
if($_FILES["image"]["error"][$i] > 0)
{
echo "Return Code: " . $_FILES["image"]["error"][$i] . "<br>";
}
$sql=Author::check_document_details_Call($name);
$exist=$sql[0]->result;
if($exist == "1")
{
echo $filename." already exists.<br> ";
}
else
{
$uploadSuccess=move_uploaded_file($_FILES["image"]["tmp_name"][$i],$destinationPath);
if( $uploadSuccess )
{
if($extension=='txt')
{
convertTextFile($destinationPath,"uploads/".$filename.".html");
$filename=$extension.".html";
}
$document_details=Response::json(DocumentProperty::insert_document_property_Call($name,$destinationPath));
echo "Update ".$name." successfully!!<br>";
}
else
{
return Response::json('error', 400);
}
}
}
$i++;
}
}
}
function convertTextFile($inputFileName,$outputFileName)
{
convertTxtToHtml($inputFileName,$outputFileName);
}