This post was last edited by barry963 on 2013-10-14 05:06:46
JavaScript php jquery Ajax
Hello everyone, I am doing a website, the website can be automatically generated by jquery Excel file and download. The function that you want to implement now is to use PHP to send the generated Excel file as an attachment. So, the first step should be to automatically pass the generated Excel file to PHP. So I ask you there is no way.
The code to generate the Excel file is as follows
$ (document). Ready (function () { $ ("#excelExport"). Click (function () { var fileexample;//file Declaration ... .//Generate file Fileexample.click ();//download file return fileexample; });
I have tried some methods, listed, and perhaps helpful:
1. The fileexample file in the code, which is the generated file, is passed directly to PHP via the jquery Ajax POST request and cannot be successful. But ordinary variables, such as strings, can be passed.
2. Pass the raw data of the generated file to PHP, generate the file from PHP, but do not know how to do it.
Thank you in advance for your help. Because of the first contact with such items, what is the pattern of Tucson broken place please forgive us.
Reply to discussion (solution)
Pass data to PHP to have PHP generate files and send messages
Please consult the Phpexcel class library
Https://github.com/PHPOffice/PHPExcel
The browser's security settings require the browser to upload files only if the user clicks on it.
If you want to upload automatically, you should submit the data directly instead of the file.
Thank you upstairs two, I try!
It's done, thank you. Finally, the data is passed to PHP, and the file is generated on the server side.