Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP page path not found error.... urgent help please...

Status
Not open for further replies.

aspnewbee

MIS
Jul 11, 2004
34
US
Hi All... I created an upload page... this is the page that processes the UPLOAD function... when I try to upload I'm getting a
Code:
Error Type:
Microsoft VBScript runtime (0x800A004C)
Path not found/admin/conferences/outputFile_testing.asp, line 67

HERE IS MY CODE:

Code:
RequestBin = Request.BinaryRead(byteCount)
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")

BuildUploadRequest  RequestBin

authUsername = UploadRequest.Item("authUsername").Item("Value")
docName = UploadRequest.Item("docName").Item("Value")
contentType = UploadRequest.Item("blob").Item("ContentType")
filepathname = UploadRequest.Item("blob").Item("FileName")
filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
value = UploadRequest.Item("blob").Item("Value")

'Create FileSytemObject Component
 Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
 
'Create and Write to a File
 pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14
 Set MyFile = ScriptObject.CreateTextFile(Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd)&"../conferences/upload/"&filename)
 
 For i = 1 to LenB(value)
	MyFile.Write chr(AscB(MidB(value,i,1)))
 Next
 
 MyFile.Close

Line 67 is

Set MyFile = ScriptObject.CreateTextFile(Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd)&"../conferences/upload/"&filename)

Any help would be greatly appreciated. Thanks all in advance.

A.
 
try directly uisng the following stmt

Left(Request.ServerVariables("PATH_TRANSLATED"), inStrRev(Request.ServerVariables("PATH_TRANSLATED"), "\")) & <<actual file name>>

__________
[cheers]
Niraj...
&quot;The unexpected success is not just an opportunity for innovation. It demands innovation.&quot;
[noevil]
 
Hi... I can't use the actual filename as the file that is being uploaded is unknown... this page has a file uploading feature... people can upload any file they want... so can't really specify which file is being uploaded... any help?

Thanks...
A.
 
Hello aspnewbee,

How does the engine determine the "../" part of the path?

regards - tsuji
 
I specify the path like this:

Code:
pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14
 Set MyFile = ScriptObject.CreateTextFile(Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd)&"../conferences/upload/"&filename)

If you want to look at more code.. please look up... I posted some of it... otherwise I can also post it again... Thanks a lot...

A.
 
aspnewbee,

On the face of it, your path eventually becomes something like "c:/abc/def/ghi/[red]../conferences/upload/uvw.xyz[/red]". That does not look like a very promising path for fso to handle. In that string, ".." would have lost its conventional meaning. That's why my note above. Response.write that evaluated path see the result.

- tsuji
 
Hi tsuji... thank you for the help... I tried to give it a physical path... "c:\abc\upload\&filename" and it still doesn't work. So I took out the part which is actually "Creating and Writing to a File" and it works fine... only problem is the physical file is not getting uploaded. I hope I'm clear in my explaination. This is the part that is actually creating and sending the file to the folder... so is there any other way that I can get the file written to the path other than the way I'm using it below. Please let me know.

Code:
'Create and Write to a File
 pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14
 Set MyFile = ScriptObject.CreateTextFile(Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd)&"c:\inetpub\[URL unfurl="true"]wwwroot\conferences\upload\"&filename)[/URL]
 
 For i = 1 to LenB(value)
	MyFile.Write chr(AscB(MidB(value,i,1)))
 Next
 
 MyFile.Close
 Response.Write pathEnd


Thanks
A.
 
aspnewbee,

I can only guess. Suppose your
[tt]Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd)[/tt]
gives you something like
[tt]"c:\inetpub\wwwroot"[/tt]
Then the parameter passed to createtextfile method might be something like
[tt]Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd) & "\conferences\upload\" & filename[/tt]
Suppose filename is given by:
filename="abc.def"
then the parameter would be a string read as:
[tt]"c:\inetpub\wwwroot\conferences\upload\abc.def"[/tt]
a good enough path format for createtextfile() method.

In any case, that is the idea. Hope not bothering you with elementary stuff.

- tsuji
 
Thanks tsuji... you were not at all bothering with any elementary stuff infact I'm greatful to you for your patience... I tried all the possibilities and nothing worked... so I was thinking I have my basics wrong... anyways.. even when put the path like "\conferences\upload\" & filename... it doesn't work... so thats why I posted my code here... I donno what I'm doing wrong. Anyways thanks for all the help and patience.

A.
 
aspnewbee,

>Set MyFile = ScriptObject.CreateTextFile(Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd)&"c:\inetpub\
Can you response.write this?
response.write Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd)

What does the screen show you?

And the part
c:\inetpub\definitely would not be ok. But look at the first part first and I think you'll get the problem clear up.

- tsuji
- tsuji
 
oh BTW the outputFi... I think its getting it from the name of the asp page... (where this code exists). I named the file outputFile.asp... so its taking the first few letters from it.

Thanks again
A.
 
Hi tsuji...

Thanks a million man... I figured it out... for some reason.. after the path I put put -14 and it was not cutting the whole thing... (outputFile.asp) so I had to put more than 14 to fix the path... it works fine now... but I'm still surprised that its taking more than 14 letters... (outputfile.asp = 14) but for some reason it needs 22... oh well as long as it works... thanks again for all the help...

A.
 
aspnewbee,

What is the magic needing 20 to accomplish what 14 can do? Probably, those are the control characters after the path in request.querystring or alike.

Glad you sort it out.

- tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top