The javascript generated file is sent to php. This post was last edited by barry963 from 2013-10-1405: 06: 46. Hello, I am working on a website, this website can be automatically generated and downloaded by jquery. The function is to use php to send an email as an attachment to the generated excel file. Therefore, javascript generates a file and transmits it to php.
This post was edited by barry963 at 05:06:46 on. I am working on a website where jquery can automatically generate and download excel files. The function is to use php to send an email as an attachment to the generated excel file. Therefore, the first step is to automatically pass the generated excel file to php. So is there any way for you.
The code for generating an excel file is as follows:
$ (Document). ready (function (){
$ ("# ExcelExport"). click (function (){
Var fileexample; // File declaration
... // Generate a file
Fileexample. click (); // download the object
Return fileexample;
});
});
I have tried some methods and listed them. it may be helpful:
1. the fileexample file in the code, that is, the generated file, is directly sent to php through the POST request of jquery ajax. However, common variables such as strings can be passed.
2. pass the original data of the generated file to php. the file is generated by php, but you do not know how to do it.
Thank you for your help in advance. For the first time I came into contact with such projects, please forgive me for any illustrations. Javascript php jquery? Share with ajax:
------ Solution --------------------
Pass data to php for php to generate files and send emails
Please refer to PHPExcel class library
Https://github.com/PHPOffice/PHPExcel
------ Solution --------------------
The browser's security settings require that the browser Upload files only when the user clicks.
To automatically upload data, you must submit the data directly instead of files.