INPUT type=file problem

R

Ron Hinds

I have the following code on my ASP page:

<INPUT type=file name="FileUpload" value="<%=FileName%>">

I'm passing the value of FileName as part of the Query String and assigning
it like so:

FileName = Request.QueryString("FileName")

It is definitely being passed/assigned correctly - I have this line for
debugging purposes:

Response.AppendToLog "FileName=" & FileName

which outputs the following in the webserver log file (abbreviated for
space):

GET /content/UploadDB.asp FileName=D:\Database\ClassTool.mdb 200

The question is - why isn't the file name showing up in the INPUT box?
 
B

Bob Barrows [MVP]

Ron said:
I have the following code on my ASP page:

<INPUT type=file name="FileUpload" value="<%=FileName%>">

Modern brwsers will not allow setting the value attribute of INPUT elements
of type "file", as it's a security hole that could be used by hackers.
 
R

Ron Hinds

Bob Barrows said:
Modern brwsers will not allow setting the value attribute of INPUT elements
of type "file", as it's a security hole that could be used by hackers.



--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Thanks - that, at least, explains it! I was just trying to provide
convenience for my end users but I guess they will have to "suffer" ;-)
 
R

Rob Meade

...
Thanks - that, at least, explains it! I was just trying to provide
convenience for my end users but I guess they will have to "suffer" ;-)

I faced the same problem a few years back - there is a way around it - but
not just by popping the value into the box...

Take a look at the SoftArtisans website (www.softartisans.com) - we use the
SA-FileUp product, and in one application in conjunction with XFile (another
of their products) - this will allow this to be done as it'll use their
component as opposed to the standard INPUT box...

Of course, this might all be more effort than you want make, I know it felt
that way for me - which is why I kept re-iterating to my boss that it
couldn't be done - alas - he didn't have any of it and we got the component.
In our scenario - we use it "blindly" - ie, we just pass the component a
file name and it simply takes it from the users PC and starts the upload
process (this is used on our corporate network as opposed to on a www
environment so a little naughty)...I seem to remember that there were
options for whether the process was hidden or not...

Regards

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top