IIS中的PHPExcel错误加载文件错误:无法打开临时/读取!文件不存在

时间:2017-12-11 13:59:56

标签: php iis phpexcel

我遇到了错误。在互联网上阅读我所能做的一切。仍然没有运气..我希望有人可以回答这个关于Windows IIS中的PHPExcel 这是我的代码,它适用于XAMPP(但不适用于IIS):

  <?php  set_include_path(get_include_path() . PATH_SEPARATOR . 'Classes/');

    /** PHPExcel_IOFactory */
    include 'PHPExcel/IOFactory.php';
                move_uploaded_file($_FILES["file"]["tmp_name"],
                "temp/" . $_FILES["file"]["name"]) ;

    $inputFileName = "temp/".$_FILES["file"]["name"];  // File to read
    //echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
    try {
        $objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
    } catch(Exception $e) {
        die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
    }

$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
print_r($sheetData);
$bilang=0;
$pumasok=0;
$hindi=0;
$iHerd= $_SESSION['urHerd'];
$iAnit = 1;
foreach($sheetData as $rec)
{   
$bilang++;
//////etc etc
}
?>

我收到此错误: 加载文件“Animal.xlsx”时出错:无法打开temp / Animal.xlsx进行阅读!文件不存在。

提前完成

2 个答案:

答案 0 :(得分:0)

我已经通过更改PHPExcel类用作临时文件夹的文件夹的读写权限来解决了这个问题,我在我的php代码中设置了导入文件....非常感谢您查看时间

答案 1 :(得分:0)

试一试:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at javaassignment.Main.<init>(Main.java:57)
    at javaassignment.Main.lambda$main$0(Main.java:254)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
BUILD SUCCESSFUL (total time: 2 seconds)

行代码后需要“PHPExcel.php”