Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 15th, 2003, 12:54 PM
Registered User
 
Join Date: Dec 2003
Location: Glen Gardner, NJ, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
  #2 (permalink)  
Old December 15th, 2003, 04:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

What is in request("filename")? Maybe the Invalid Path Character is there? Add this line and see what it displays:
Response.Write request("filename")
Reply With Quote
  #3 (permalink)  
Old December 15th, 2003, 05:25 PM
Registered User
 
Join Date: Dec 2003
Location: Glen Gardner, NJ, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #4 (permalink)  
Old December 16th, 2003, 01:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Sydney, NSW, Australia.
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #5 (permalink)  
Old December 16th, 2003, 06:54 AM
Registered User
 
Join Date: Dec 2003
Location: Glen Gardner, NJ, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #6 (permalink)  
Old December 17th, 2003, 02:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Sydney, NSW, Australia.
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #7 (permalink)  
Old December 18th, 2003, 05:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

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?
Reply With Quote
  #8 (permalink)  
Old December 18th, 2003, 06:59 AM
Registered User
 
Join Date: Dec 2003
Location: Glen Gardner, NJ, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #9 (permalink)  
Old December 18th, 2003, 08:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

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?
Reply With Quote
  #10 (permalink)  
Old December 19th, 2003, 09:05 AM
Registered User
 
Join Date: Dec 2003
Location: Glen Gardner, NJ, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Message: Asp.Net Server failed to start ... ramakrishna.one .NET Framework 2.0 0 June 9th, 2007 03:23 AM
ASP SQL portal install error message MaryLuke Classic ASP Databases 2 October 21st, 2006 02:37 PM
"Server not running ASP.NET 1.1" error message arashj General .NET 1 September 7th, 2004 05:49 AM
chapter 6, page 173-175, error in sql syntax vkranendonk BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 May 26th, 2004 12:30 PM



All times are GMT -4. The time now is 07:21 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.