Solved

ASP upload 'An invalid '/' or '\' was found in the Path parameter for the MapPath method'

Posted on 2004-09-03
14
632 Views
Last Modified: 2012-08-14
Every1 - please can you help

I am having problems with an upload script

I have :

(server.mappath("/images/" & response.Write(request("deptid")) & "/" & "thumb"))

It doesnt work, the error is:

An invalid '/' or '\' was found in the Path parameter for the MapPath method.

Why?  How can I resolve it?


0
Comment
Question by:tingleweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +3
14 Comments
 
LVL 22

Expert Comment

by:neeraj523
ID: 11970776
Hello

try this

<%
Response.Write Server.mapPath("/images/") & "/" & Request("deptid")) & "/thumb"
%>

neeraj523
0
 
LVL 3

Expert Comment

by:Ayesha_K
ID: 11970961
try

server.mappath("/images/" & request("deptid") & "/" & "thumb")

and make sure request("deptid") has some value
0
 

Author Comment

by:tingleweb
ID: 11971474
Guys

Count = Upload.Save(Response.Write Server.mapPath("/images/") & "/" & Request("deptid")) & "/thumb")


and

Count = Upload.Save(server.mappath("/images/" & request("deptid") & "/" & "thumb"))

Both throw the error :
An invalid '/' or '\' was found in the Path parameter for the MapPath method.
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 3

Expert Comment

by:Ayesha_K
ID: 11971572
try

server.mappath("images/" & request("deptid") & "/thumb")

or if the images folder is one level higher than your folder ... then try

server.mappath("../images/" & request("deptid") & "/" & "thumb")
0
 

Author Comment

by:tingleweb
ID: 11971807
mm...still not working

(.. arent allowed in the server.mappath it says)

This works by the way - it is another upload script for the main images directory...

(server.mappath("/images/" & response.Write(request("deptid"))))
0
 
LVL 3

Expert Comment

by:Ayesha_K
ID: 11972077
are you sure there is a thumb directory in the request("deptid") directory ???
0
 

Expert Comment

by:N_F_S
ID: 11972768
 Hi,

 I assume you are using ASPupload component? This is how I would do, you don't need response.write:

Count = Upload.Save (Server.MapPath("images/") & "/" & Request("deptid")) & " & "/" & "thumb")

I  didn't test this, but it should work, let me know

N_F_S
0
 

Expert Comment

by:N_F_S
ID: 11972803

 Yes, as Ayesha_K  said, it seems you want to generate a folder from "deptid" request......make sure the "deptid"(the value from it) folder & thumb folder exists

N_F_S
0
 
LVL 6

Expert Comment

by:masirof
ID: 11973118
Looks like Request("deptid") is empty. Please try tp replace "\" to "/" or vice versa.
0
 
LVL 6

Expert Comment

by:masirof
ID: 11973975
Using REPLACE command
0
 
LVL 11

Expert Comment

by:mouatts
ID: 11975281
If request("deptid") is empty the string being passed to Mappath is "/images//thumb" hence the error message.

(server.mappath("/images/" & response.Write(request("deptid"))))
works because response.write does not resolve to nothing hence the entire string passed to Mapppath is "/images/"

Either check that deptid is not empty and then if ok use

Server.mapPath("/images/") &  Request("deptid") & "/thumb"


or if you are happy to omit the deptid bit when it is empty try adding the following

function NVL2(f,r,nr)
on error resume next

NVL2=nr
IF f=vbNullstring or len(f)<1 or isNull(f) THEN
      NVL2=r
END IF
END FUNCTION


Then use
 
Server.mapPath("/images") &  nvl2(Request("deptid"),"","/"&request("deptid")) & "/thumb")

The NVL2 function tests the first parameter and if null/empty returns the second parameter otherwise returns the third parameter.

HTH
Steve
0
 
LVL 22

Expert Comment

by:neeraj523
ID: 11978851
Hello


Can you tell me the output of this

<%
Response.Write Server.mapPath("/images/") & "/" & response.Write(request("deptid") & "/thumb"
%>

neeraj523
0
 
LVL 11

Accepted Solution

by:
mouatts earned 250 total points
ID: 11979525
Well I don't know what map path will resolve it to but its going to be something like
c:\inetpub\wwwroot\images//1/thumb
assuming that deptid = 1 and that images is under the wwwroot directory. So in my example above I also had the slashes the wrong way round so it should have read

Server.mapPath("/images") &  nvl2(Request("deptid"),"","\"&request("deptid")) & "\thumb")

HTH
Steve
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question