1

i'm working on a project which is allowing a user to upload an excel file, and when the user click submit, the data from the excel file will get into MSSQL database. for now, the upload is working, but it couldn't get into the MSSQL database.

i've used the same script before and it worked fine (Windows XP). now that i've changed my machine to Windows 7, i get that COM error. i've tried almost everything that i could get online (the dcomcnfg configuration), but none is helping.

pls help.

below are the error message:


<pre>
Application name: Microsoft Excel

Loaded version: 14.0

function import-->open below filename: 
C:/xampp/htdocs/www/mysystem/tmp/import_excel_0.32887000 1336015991.xls

Fatal error:  Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft Excel<br/><b>Description:</b> Microsoft Excel cannot access the file 'C://xampp/htdocs/www/mysystem/tmp/import_excel_0.32887000 1336015991.xls'. There are several possible reasons:

• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.' in C:\xampp\htdocs\www\mysystem\import\ImportData.php:52
Stack trace:
#0 C:\xampp\htdocs\www\mysystem\import\ImportData.php(52): variant->Open('C:/xampp/htdocs...')
#1 C:\xampp\htdocs\www\mysystem\import\ImportData.php(19): Import('C:/xampp/htdocs...')
#2 C:\xampp\htdocs\www\mysystem\index.php(698): require('C:\xampp\htdocs...')
#3 {main}
  thrown in C:\xampp\htdocs\www\mysystem\import\ImportData.php on line 52

1
  • I think you need to give more information here: it isn't clear what the OS is on server and client (or are they the same machine?), where/when the error appears, what MSSQL has to do with the error, whether you have investigated the 3 points suggested in the error message, and if any permissions are different on the filesystem between the XP and 7 boxes. Commented May 3, 2012 at 9:23

1 Answer 1

2

Ok this solved it for me

if you’ve got IIS configured try this:

  • Run “dcomcnfg” to get to Component Services
  • Open Component Services > Computers > My Computer > DCOM Config
  • Search for Microsoft Excel Application or the appropriate application you working with on COM
  • Right-Click on it and open the properties
  • Choose “Identity” tab
  • Normally this is set to “the launching user” by default. You have to change this to “the interactive user”.
  • Apply these new settings and test your COM application. It should work fine now.

http://www.php.net/manual/en/class.com.php

Sign up to request clarification or add additional context in comments.

1 Comment

Be careful when posting copy and paste boilerplate/verbatim answers to multiple questions, these tend to be flagged as "spammy" by the community. If you're doing this then it usually means the questions are duplicates so flag them as such instead: stackoverflow.com/a/12830578/419

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.