上传文件后运行PHP代码

问题描述 投票:0回答:1

我正在使用JQuery File Upload将excel文件上传到我的服务器。我需要能够使用PHPSpreadsheet然后从excel文件中读取值,以便我可以将它们导入数据库。两者都应该在同一页面中发生。如何在文件上传后使用ajax自动运行PHPSpreadsheet代码?

php jquery ajax phpspreadsheet
1个回答
0
投票

在上传期间,客户端包括服务器端的URL(上传处理程序),此服务器端可以包含您想要的所有内容,例如在客户端:

<form id="fileupload" action="../server/php/" method="POST" enctype="multipart/form-data">

您在表单上指定服务器端:action="../server/php/"

在服务器端,您可以处理上传,完成后您可以执行您想要的操作!

这是上传的官方示例,您可以使用它,直到您成功上传示例文件,然后您可以在您的项目中实现它:

客户方:https://github.com/blueimp/jQuery-File-Upload/blob/master/test/index.html

服务器端:https://github.com/blueimp/jQuery-File-Upload/tree/master/server/php

祝好运 !

© www.soinside.com 2019 - 2024. All rights reserved.