Tom Fong
Tom Fong

Reputation: 77

upload file and auto down to local for access

I'm writing a portlet web app to allow user upload a excel file, and then the backend will do the validation to the excel file and convert the content into sql statement

The back-end is using java with library aspose.cells to handle the excel access.

The problem is, how can I pass the excel to back end to access.

Now I've think of after user upload the excel file, the back end first will download the excel file to local (maybe C:\temp), and then it can directly read the excel file from C:\temp rather than server file.

But it's possible to do it?

Upvotes: 0

Views: 58

Answers (1)

Ahsan Iqbal
Ahsan Iqbal

Reputation: 81

You seem to be looking for some sample code where you may upload an Excel file and then using Aspose.Cells for Java, process this uploaded file. You may have a look at the following link where a tutorial is there for uploading files using portlets.

http://www.codeyouneed.com/liferay-portlet-file-upload-tutorial/

Once the file is uploaded, use com.aspose.cells.Workbook class object for loading this stream directly into Workbook and then process it as per your requirement.

Following is the link to sample code for loading Excel file (in stream) into Workbook object: https://docs.aspose.com/display/cellsjava/Opening+Files+with+Different+Formats#OpeningFileswithDifferentFormats-OpeningthroughStream

Note: I am working as Support developer/ Evangelist at Aspose.

Upvotes: 0

Related Questions