Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-09-03
14
Medium Priority
?
634 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 1000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

719 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