 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 15th, 2003, 12:54 PM
|
|
Registered User
|
|
Join Date: Dec 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ASP Error Message 173
Hi,
I am new to ASP and I have taken over a site that another developer created. Part of the site allows the client to upload data from csv files to a SQL database. Every time the client tries to upload the file the get the following error message:
Server.MapPath() error 'ASP 0173 : 80004005'
Invalid Path Character
/cadmin/up2.asp, line 10
An invalid character was specified in the Path parameter for the MapPath method.
Here is the code for line 10:
filename = request("filename")
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Dim objTextStream
Set objTextStream = objFSO.OpenTextFile("" & Server.MapPath("excel_files/" & request("filename") & "") & "", 1, false, 0)
I have tried several things to fix this but nothing seems to work. I have removed the underscore, copied code from another page on the website that works
Thanks
Joe C.
Renisar Technology Solutions
www.renisar.com
|
|

December 15th, 2003, 04:28 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
|
|
What is in request("filename")? Maybe the Invalid Path Character is there? Add this line and see what it displays:
Response.Write request("filename")
|
|

December 15th, 2003, 05:25 PM
|
|
Registered User
|
|
Join Date: Dec 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi, The request("filename") is the file the user chooses to upload. I added the code you suggested but do not see any invalid characters.
Here is what was returned by the Response.Write command:
"check_file_121503.csv"
I still received the same error message after that.
Thanks
Joe C.
Renisar Technology Solutions
www.renisar.com
|
|

December 16th, 2003, 01:56 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Can you please clarify your last post?
Is Request("filename") the file that the user chooses to upload?
or
Is Request("filename") the name of the file that the user chooses to upload?
The former is probably in a binary format, or contains illegal characters...
Cheers
Ken
Microsoft MVP - Windows Server (IIS)
www.adOpenStatic.com
|
|

December 16th, 2003, 06:54 AM
|
|
Registered User
|
|
Join Date: Dec 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Ken,
There is a browse button on the page that allows the user to browse to choose a file from thier computer to upload. The file is a cvs file with the columns in a particular order to match the SQL database.
I am not sure what you mean by binary and why the check_file_120503.csv would cause any errors.
Thanks for your help,
Thanks
Joe C.
Renisar Technology Solutions
www.renisar.com
|
|

December 17th, 2003, 02:56 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
If Request("filename") is the actual *file* itself, then when you do Server.Mappath(Request("filename")), then you are pasting the entire contents of the file into the Server.Mappath() call. And the file probably contains illegal characters. So, for example, if the file contained:
field1, someotherdata, field3, hello
then you'd be doing:
Server.Mappath("field1, someotherdata, field3, hello")
Do you see now? You need to pass the file's *name* into the Server.Mappath() function, not the actual file itself. That is why I'm asking what Request("filename") actually refers to
Cheers
Ken
Microsoft MVP - Windows Server (IIS)
www.adOpenStatic.com
|
|

December 18th, 2003, 05:35 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Ken, I don't think that's the case here because the OP said that Response.Write Request("filename") outputs check_file_121503.csv.
Maybe the problem is with the path that is returned by MapPath (I know MapPath can be a bit picky about certain characters in paths, like commas).
Joe, what path do you expect MapPath to return?
|
|

December 18th, 2003, 06:59 AM
|
|
Registered User
|
|
Join Date: Dec 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
I expect the MapPath to return the path to the file in the user's computer. Something like:
C:\misc\documents\check_file_121503.xls
The other thing I have realized is that when I look at the excel_files folder on the server the file I am trying to uplaod is making it to the folder. I am just getting the error message which is preventing the user from proceeding to update the SQL database with the data from the excel file. I have also tried converting the excel file to csv file which has not worked either.
Thanks
Joe C.
Renisar Technology Solutions
www.renisar.com
|
|

December 18th, 2003, 08:42 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Joe, that's not right. MapPath will return the path of the excel_files folder on the server, not on the client's PC. What is the physical path to the excel_files folder on the server?
|
|

December 19th, 2003, 09:05 AM
|
|
Registered User
|
|
Join Date: Dec 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
The path to the excel_files folder on the server is
/sentry/www/cadmin/excel_files
Thanks
Joe C.
Renisar Technology Solutions
www.renisar.com
|
|
 |