Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Help with script error


Message #1 by "Amjad Ali" <amjad2000@h...> on Mon, 19 Mar 2001 22:11:08
I have a discussion forum that I want to add the capability for 

attachments, I tried some of the free components out there with out any 

luck, maybe I was not willing to change what I have working, anyway, now I 

am trying to use the filesystemobject to upload the file to the server 

or "copying" it, the process works fine on my testing machine which is a 

standalone with IIS 5 win2000, but when I move the code to the server I 

start getting problems.



Here are the lines of code for my form and file - I am trying to stay a 

way form the "ENCTYPE="multipart/form-data" and read the name of the file 

using Request.Form("file1")



response.write "<form name='myform' action='" &getaction & "' 

method='post' >"

Response.Write "<input type='file' name='file1' size=50><br>"



This code will get the name of the file without the drive and the folder 

it is in 

if Request.Form("file1")<> "" then

	strlen = len(Request.Form("file1"))

	For i = strlen To 1 Step -1

		smallstr = Right(Request.Form("file1"), strlen - (i - 1))

		If InStr(1, smallstr, "\") Then

		    g = i

		    Exit For

		End If

        Next

   FName = Right(Request.Form("file1"), strlen - g)

end if



The reason I did not use 

Set f = LoadFile.GetFileName(Request.Form("file1"))

instead of the chunk of code above because I was getting an error that the 

file was not found   



Now when I comment out the code above in the if statement my form is 

working without any error, but if I leave like this I get an error saying 

The page cannot be displayed...



Sorry if confused any one out there, and thanks for your help in advanced



I have some questions maybe it will solve my problem since my code is 

large and I cannot post it all: -



Q1. if I use Response.Write "<input type='file' name='file1' 

size=50><br>" , without the "ENCTYPE="multipart/form-data" in the form 

tag, can I read the value of the file1 using request.form(?file1?) and 

what about the other form items like the name and subject do I still use 

request.form(?subject?)?



Q2. Why is my code working on my standalone machine and not working when I 

put on the server?



Q3. I am not getting description of the errors with IIS 5, The page cannot 

be displayed is not helping, it only add more frustration, is there 

something I could do to get a better description of the errors?



Message #2 by "Daniel O'Dorisio" <dodorisio@h...> on Mon, 19 Mar 2001 18:02:25 -0500
about q3. check in your advanced interent settings tab and make sure that

"friendly error messages" is turned of or unchecked.







-----Original Message-----

From: Amjad Ali [mailto:amjad2000@h...]

Sent: Monday, March 19, 2001 10:11 PM

To: ASP Databases

Subject: [asp_databases] Help with script error





I have a discussion forum that I want to add the capability for

attachments, I tried some of the free components out there with out any

luck, maybe I was not willing to change what I have working, anyway, now I

am trying to use the filesystemobject to upload the file to the server

or "copying" it, the process works fine on my testing machine which is a

standalone with IIS 5 win2000, but when I move the code to the server I

start getting problems.



Here are the lines of code for my form and file - I am trying to stay a

way form the "ENCTYPE="multipart/form-data" and read the name of the file

using Request.Form("file1")



response.write "<form name='myform' action='" &getaction & "'

method='post' >"

Response.Write "<input type='file' name='file1' size=50><br>"



This code will get the name of the file without the drive and the folder

it is in

if Request.Form("file1")<> "" then

	strlen = len(Request.Form("file1"))

	For i = strlen To 1 Step -1

		smallstr = Right(Request.Form("file1"), strlen - (i - 1))

		If InStr(1, smallstr, "\") Then

		    g = i

		    Exit For

		End If

        Next

   FName = Right(Request.Form("file1"), strlen - g)

end if



The reason I did not use

Set f = LoadFile.GetFileName(Request.Form("file1"))

instead of the chunk of code above because I was getting an error that the

file was not found



Now when I comment out the code above in the if statement my form is

working without any error, but if I leave like this I get an error saying

The page cannot be displayed...



Sorry if confused any one out there, and thanks for your help in advanced



I have some questions maybe it will solve my problem since my code is

large and I cannot post it all: -



Q1. if I use Response.Write "<input type='file' name='file1'

size=50><br>" , without the "ENCTYPE="multipart/form-data" in the form

tag, can I read the value of the file1 using request.form(?file1?) and

what about the other form items like the name and subject do I still use

request.form(?subject?)?



Q2. Why is my code working on my standalone machine and not working when I

put on the server?



Q3. I am not getting description of the errors with IIS 5, The page cannot

be displayed is not helping, it only add more frustration, is there

something I could do to get a better description of the errors?




  Return to Index