I am attempting to create an excel file through php and dynamically open it in excel. But I want to download and prompt the user to either open it or save it. The prompt appears and it saves to the desktop if the user selects that option.
But the problem lies in the 'Open' option. When the user clicks 'Open', it opens excel, and then an error comes up stating that the file cannot be found (it is looking in the IE temp directory for the file). This is what I have:
Ive tried quotes, no quotes, line breaks, etc., but nothing seems to work. I don't want to get rid of the attachment option because then I will be redirected to another page.
If excel is already open, there is no error. It only occurs when excel has to be opened prior to opening the downloaded file.
Any ideas?
But the problem lies in the 'Open' option. When the user clicks 'Open', it opens excel, and then an error comes up stating that the file cannot be found (it is looking in the IE temp directory for the file). This is what I have:
Code:
header( "Content-type: application/vnd.ms-excel\r\n" );
header( "Content-Disposition: attachment; filename=\"bob.csv\"" );
Ive tried quotes, no quotes, line breaks, etc., but nothing seems to work. I don't want to get rid of the attachment option because then I will be redirected to another page.
If excel is already open, there is no error. It only occurs when excel has to be opened prior to opening the downloaded file.
Any ideas?