# Solved: ASP file upload issue



## AKA Arizona (Jul 22, 2003)

I am having an issue with file uploads, 

Server.MapPath() error 'ASP 0175 : 80004005'

Disallowed Path Characters

/functions/functions_upload.asp, line 77

The '..' characters are not allowed in the Path parameter for the MapPath method. 

is the error I get while trying to upload a picture, I have looked at my line 77 and have found no error what am I missing?

Her is line 77
If objFSO.FolderExists(Server.MapPath(strFileUploadPath & "\" & strUserFolderName)) = False Then


----------



## Rockn (Jul 29, 2001)

What is the name of the file? Have you tried other files? Does it happen with every file? You might want to try and write the file path to a test page to see what the path name actually looks like.


----------



## AKA Arizona (Jul 22, 2003)

Rockn said:


> What is the name of the file? Have you tried other files? Does it happen with every file? You might want to try and write the file path to a test page to see what the path name actually looks like.


Are you asking for the name of my main database?

Yes I have tried other files and it still occurs.


----------



## Rockn (Jul 29, 2001)

I meant to have your form action write the path string to a test page. Make the form action be test.asp, write a page named test.asp and output the strFileUploadPath & "\" & strUserFolderName strings to that page writing it out with response.write

Just for grins change the "\" to "/" to see if it works.


----------



## AKA Arizona (Jul 22, 2003)

instead of strfileuploadpath can I not just put in the path? I am using web wize for my forum and asp smart upload for the upload handler


----------



## AKA Arizona (Jul 22, 2003)

After doing additional research I have discovered that I need have or turn on The ASP File System Object (FSO) How do I know if its on or if I even have one I am hosting from my own server running Windows server 2003


----------



## Rockn (Jul 29, 2001)

Paste this into a new ASP document. If it returns the available drive space on C the FSO is working and your script is messing up.

<% 
drivename="c:\"
Set fso = CreateObject("Scripting.FileSystemObject")
set maindrive=fso.GetDrive(drivename)
response.write maindrive.AvailableSpace
%>


----------



## AKA Arizona (Jul 22, 2003)

Cool little script  and yes it works so back tot he script issue


----------



## Rockn (Jul 29, 2001)

Post back the strings for 
strFileUploadPath = and strUserFolderName=

There is probably something like:
Dim strFileUploadPath, strUserFolderName
strFileUploadPath = blablalbla
strUserFolderName = blablabla

I wanna know what the blablabla equals for both strings.


----------



## AKA Arizona (Jul 22, 2003)

Are you talkin about the stuff in my first post?

If objFSO.FolderExists(Server.MapPath(strFileUploadPath & "\" & strUserFolderName)) = False Then


----------



## Rockn (Jul 29, 2001)

No, there is a place in the code where the parameters are defined.
You would be better off posting the whole page.


----------



## AKA Arizona (Jul 22, 2003)

OK I figured out where the .. was coming from and fixed that now I get this

Microsoft VBScript runtime error '800a004c'

Path not found

/functions/functions_upload.asp, line 80 

I have attached my functions_upload.asp file


----------



## Rockn (Jul 29, 2001)

The path not found is from component you are using. Which ASP component are you using to upload files...ASP Simple Upload or other?


----------



## AKA Arizona (Jul 22, 2003)

asp smart upload


----------



## Rockn (Jul 29, 2001)

Apparently the component doesn't give you the option to set up a custom upload directory. You have to set it up per their instructions:

Stage 3 : Install aspSmartUploadUtil.dll

The objective is to enable the Operating System to access the aspSmartUploadUtil.dll file.

There is two ways to archieve this :
- Copy aspSmartUploadUtil.dll in the c:\winnt\system32 directory. That way you don't have to update the PATH propertie.
- Copy aspSmartUploadUtil.dll into a directory on the NT server (e.g. c:\mydir).
Add the component directory in the PATH using the commands :
PATH=%PATH%;c:\mydir (From DOS)

Stage 4 : Install samples

Installation
The ASP application must be installed in an ASP-script-enabled web directory.

If your site has the following structure :
\inetpub
\inetpub\scripts
\inetpub\wwwroot

Copy the
\temp\aspSmartUpload\MyInetpub\scripts\aspSmartUpload directory
to the
\inetpub\scripts directory on your server.
Copy the
\temp\aspSmartUpload\MyInetpub\wwwroot\aspSmartUpload directory
to the
\inetpub\wwwroot directory on your server.

Test
Using your browser, enter the following addresses :


----------



## AKA Arizona (Jul 22, 2003)

I did that stuff first, but now the hangup I am not using the
\inetpub
\inetpub\scripts
\inetpub\wwwroot

directory structure all of my websites are on a second hard drive in a folder called websites
so this own would be
\websites\deputydave\forum\
should I add the inetpub etc, etc folders? then add the file respectivly...
or should I add the inetpub etc, etc then add the deputydave\forum into the wwwroot


----------



## Rockn (Jul 29, 2001)

Let me ask you this, when you extracted the installation files to a temp directory what folsder structure did it create in the temp folder? This is the same structure you have to create in the root of your web site. If it extracted a scripts folder, copy the scripts folder intact to your wwwroot\websitename\(insert folder here)
You need to create the exact directory structure that the component needs.


----------



## AKA Arizona (Jul 22, 2003)

Yes thats exactly what I did. However, my website is not in a wwwroot folder meaning its on my second drive which is D:\ so its D:\websites\deputydave\forum there is no wwwroot on my D drive C:\ drive has the inetpub blah blah but no websites I did add scripts and wwwroot inside the forum folder and put in the files from the temp location


----------



## Rockn (Jul 29, 2001)

Gotta be something really simple with the path to all of the files. I will try and set it up at home with your same setup and see what I get.

BTW, did you register the dll file with Regsvr32 on your server?


----------



## Rockn (Jul 29, 2001)

Don't know what you did, but it took me 2 minutes to set it up on my server and it did transfer files. I had to register the aspupload.dll and put the aspuploadutil.dll in the C:\winnt\system32 folder and it worked like a charm.


----------



## AKA Arizona (Jul 22, 2003)

Yep did the register and everything. OK time to punt, I will undo all that I have done so far and reinstall. How would you recommend my directory structure be.


----------



## Rockn (Jul 29, 2001)

I was looking at your directory structure again
\websites\deputydave\forum\

In IIS is that how the web site is set up of is the forum directory a sub-directory on the web site? Just copy the scripts and aspsmartupload folders into the forum directory intact and including sub-folders inside of them. THis is all you should have to do aside from registering the one dll.


----------



## AKA Arizona (Jul 22, 2003)

OK then inside my forum folder I would need a scripts folder and a wwwroot folder and what else? or are the scripts and wwwroot folders supposed to be outside the forum folder but inside the deputydave folder where deputydave would take the place of wwwroot and websites replaces scripts?


----------



## Rockn (Jul 29, 2001)

NOOO....just a scripts folder from the extracted files and an aspsimpleupload folder from the extraced files all put in the forums folder.


----------



## AKA Arizona (Jul 22, 2003)

Still no dice  I get the popup box I choose the file hit OK a box opens that says give it a minute hit OK and then the error. from post #12


----------



## AKA Arizona (Jul 22, 2003)

Where is the strFileUploadPath defined?


----------



## Rockn (Jul 29, 2001)

the functions_upload.asp is not a part of the aspsmartupload component. I would think that this is a function of your Webwiz forum that is not set up correctly to work with the component. I would think this would be in the admin section for the forum configuration.


----------



## AKA Arizona (Jul 22, 2003)

Well it looks like webwise has come out with a new version 8.0 and it looks like it has a built in upload feature, I will be be updating mine but it looks like a I have to run a database tool to migrate from old to the new..... BTW I bought a book asp.net for dummies, now I understand some of the lingo with asp but still learning sometnigs I have add to one of my clients pages with some realy cool results http://www.prentisscountysheriff.com

I am a little confused on one point in the book it says that .asp and .aspx are the same but when I save files in the .asp they do not work but when I save in the .aspx they work just fine.


----------



## Rockn (Jul 29, 2001)

ASP and .Net are not the same. Obviously your web server is serving ASP pages if it is running the forum. I think you are saving or creating your files incorrectly as the ASP engine on your version of IIS should process both.


----------



## AKA Arizona (Jul 22, 2003)

Ya there is code at the top of the .aspx pages that I've never seen before on .asp pages. 
OK so what would be a good book to get for .asp pages is there a dummy book out there?


----------



## Rockn (Jul 29, 2001)

You may as well learn ASP.NET or VB.NET since ASP probably won't be around in a few years and .NET is far mor powerful with more features. I would suggest any of the WROX press books, MS Press books relating to the subject. DO NOT get any of the learn something in (insert days here) books.


----------



## AKA Arizona (Jul 22, 2003)

So the book I have know asp.net for dummies and asp.net 2.0 for dummies along with the ones you suggested should keep me going for awhile...... .asp will be replaced with .aspx?


----------



## Rockn (Jul 29, 2001)

I am sure it will still be supported on future releases of IIS, but you may as well learn something with more bells and whisltes than plain jane ASP. Learn both, neither is really that hard to grasp.


----------



## AKA Arizona (Jul 22, 2003)

Thanks for all you help  Im gonna mark this one solved if I have issue with the update I start something new.......


----------

