I'm looking for开发者_StackOverflow中文版 some tutorial on how from a webapplication upload a file and while uploading analyzing it.
I mean a user chooses a file from his computer on a web app, the file is excel. After choosing elaborate it the file is analyzed and some stuff is done, once the work is complete the user is redirect to a webapp with the results.
I need just some hints on where to start investigating.
Many thanks!
PHP won't be able to do much analysis since it is server-side. It cannot communicate with the file until it is entirely uploaded. You may want to look at creating a Java Applet uploader to analyze a user's file before or during the upload. However, this is not to say you cannot analyze the file with PHP after the user has uploaded the file to the server.
Good luck!
Dennis M.
There are a number of libraries available for accessing the data in an Excel workbook, including my own PHPExcel which can read both .xls and .xlsx files. exactly how to transfer data from the workbook to a database depends on the content of the workbook, but basically you need to iterate through each row of a worksheet and determine its cell content, then build a SQL statement to insert that cell content into your database.
You definitely need the file to be uploaded in its entirety before you try reading it though.
精彩评论