简体   繁体   English

无法使用phpexcel上传文件

[英]cant upload file using phpexcel

i am currently using phpexcel library to read my excel file which is to be uploaded by user . 我目前正在使用phpexcel库读取要由用户上传的我的excel文件。 but i cannot at this moment :( 但是我现在不能:(

i am using this code, i cannot get the file path right at this moment and if some one could tell me , how to over ride existing file and renaming the input file. 我正在使用此代码,目前无法正确获取文件路径,如果有人可以告诉我,如何跳过现有文件并重命名输入文件。

  move_uploaded_file($_FILES["file"]["tmp_name"],
  "upload/" . $_FILES["file"]["name"]);
  $test= $_FILES["file"]["name"];
  echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
  require_once('classes/phpexcel.php');
  $objReader = PHPExcel_IOFactory::createReader('Excel2007');
  $objReader->setReadDataOnly(true);
  $objPHPExcel = $objReader->load('upload/'.$test);
  $objWorksheet = $objPHPExcel->setActiveSheetIndex('0') ;

kindly help and thanks in advance 友善的帮助,并在此先感谢

File is being transferred to the desired folder , i cannot open the file with phpexcel 文件正在传输到所需的文件夹,我无法使用phpexcel打开文件

I'd sanitize the destination file name on the move_uploaded_file. 我会在move_uploaded_file上清理目标文件名。 use something like tempnam() to generate a safe file name 使用类似tempnam()之类的东西来生成一个安全的文件名

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM