简体   繁体   中英

How to implement import/export a file functionality in spring MVC framework

I am working on functionality where I have to import a csv file in my web application.I am using following code for this:

<input name="file1" type="file" id="fileid" />   
<input type="button" id="submit" value="Import File" onclick='importTestSet( document.getElementById("fileid").value)' />  

However the above code only returns the file name instead of the full path of the file.I searched on other forums and found that this is happening due to security reasons of the browser.

1) Is there any other way to get the full path of the file while importing

2) Could you please help me with some sample code to implement this feature in spring MVC framework web application project.

您应该将该文件复制到临时文件夹中,以便当您可以在那时上传文件时,调用复制文件方法并将此方法放入输入标签<input type"file" onChange="copyFile()" />然后您必须到达这个文件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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