2007年03月19日

Read an uploaded spreadsheet document by php-SpreadsheetReader

php library

In PHP, the global array $_FILES will contain all the uploaded file information. However, the temporary filename of the file in which the uploaded file was stored on the server is not the same as source filename. If you pass the temporary filename to SpreadsheetReaderFactory, it could not detect which reader to suit.


The solution is simple. We simply take the extension name from $_FILES['userfile']['name'] and pass it to SpreadsheetReaderFactory. Then we pass $_FILES['userfile']['tmp_name'] to reader. That's all.

The following is a sample. There is a file field named 'SpreadsheetFile' in the form. PHP will put information of this uploaded file in $_FILES['SpreadsheetFile'].


Posted by shirock at 樂多Roodo! │11:32 │回應(0)引用(0)PHP
樂多分類:網路/3C 共同主題:PHP基本語法 工具:編輯本文
Ads by Roodo! 

引用URL

http://cgi.blog.roodo.com/trackback/2878923