Click to See Complete Forum and Search --> : asp upload and java filter?


jobabin
01-19-2005, 12:44 AM
Hi

I am trying to use the asp upload pages from
http://freeaspupload.net

and the java upload filter from

http://javascript.internet.com/forms/upload-filter.html

I can get both to work independant of each other but cannot seem to get them to work together.

Is there a way these two things can interact or is there a easier way to use the asp upload pages but still have a way to filter the file extensions that can be used.

Thanks
JB

lmf232s
01-19-2005, 09:48 AM
you should be able to trap for this with in the asp upload script.

Find the section were you are getting the file name or doing the
upload. split the file name at . and get the extension of the file
then just do a if statement or so and make sure its an extension
you want to upload. so like

if fileExt = ".zip" or fileExt = ".pdf" then
'skip this section we do not allow these to be uploaded
else
'well let the rest of the code fire.
end if

this should allow you to use the one script and not have to use two.

jobabin
01-19-2005, 11:39 AM
is it possible to limit the extension to one extension - i am trying to block all extensions except for .lns

lmf232s
01-19-2005, 02:40 PM
i kind of looked over the code but did not have time to find what
i was looking for.

Yes you could limit it to one type of upload.

You need to find out where about in the code, where it gets the
file path from.

in the section where you retrieve the file path name you could do
some code like this

if MyExt = "ins" then
'continue, this file is allowed
else
'do nothing more, i will not upload this file
end if

of course i am assuming MyExt is a variable that was set with
the ext.
So you would need to get the file name say

Test.ins
and you want to split at "." and grab the string to the right
which would give you .ins so
MyExt = Ubound(Split(FileName, "."))
Im not sure this above code is correct.
but the idea and the process are correct.

I have alot of work to do for the next couple of hours but later
tonight i will get on and take a closer look at if, if you still
are having problems.