thegunner
thegunner

Reputation: 7163

.net uploading file then unable to retrieve - directory path?

I can currently upload an excel file to an uploads directory:

FileUploadExcel.SaveAs(Server.MapPath("~/Uploads/ExcelImport.xls"))

But when I try to retrieve it to open it, it reports that it can't find it:

xlWorkBook = xlApp.Workbooks.Open("~/Uploads/ExcelImport.xlsx")

Error message:

'~/Uploads/ExcelImport.xlsx' could not be found. Check the spelling of the file name, and verify that the file location is correct.

If you are trying to open the file from your list of most recently used files, make sure that the file has not been renamed, moved, or deleted.


Anyone know what might be the problem or seen this before?

Upvotes: 0

Views: 163

Answers (1)

paparazzo
paparazzo

Reputation: 45096

Try

xlWorkBook = xlApp.Workbooks.Open(Server.MapPath("~/Uploads/ExcelImport.xls"))

Upvotes: 2

Related Questions