Hi all,
I am trying to create a control which will infact mimic the functionality of the HtmlInputFile control. The reason for this is purely visual, but it is a necessity to maintain the sites "look and feel".
I have tried including a transparent HtmlInputFile in my control which visually works, but the inability to exclude the HtmlInputFile's controls from the tab order is causing some problems.
I don't really understand how the HtmlInputFile works so I guess I am looking for some key terms that I can look up and learn from, or ideally a solution or example.
So I suppose :
1) Is there a way of excluding the HtmlInputFile from the tab order?
2) How does HtmlInputFile add into the HttpContext.Current.Request.Files collection?
3) How can the script "popup" the file selection dialogue box?
For security reasons browsers do not allow access to file uploading or the file selection dialog outside of the built in file upload tag. Building your own control with a custom look and feel is not feasible.
So I suppose :
1) Is there a way of excluding the HtmlInputFile from the tab order?
only by JavaScript (see onFocus event).
Crow-knee
2) How does HtmlInputFile add into the HttpContext.Current.Request.Files collection?
HttpContext.Current.Request.Files contains data posted to server from client`s form. HtmlInputFile renders to <input type="file"> tag, so the browser send selected file via HTTP protocol.
Crow-knee
3) How can the script "popup" the file selection dialogue box?
Thanks for the information. Very helpful... but also confirms what I feared.
I have tried out the document.getElementById( 'file_inpu_id' ).click(); method, but had no luck, getting the error :
htmlfile: Access is denied.
with the debugger pointing to the theform.submit();
in the html postback script. I'm running XP SP2 if that makes a difference. But I am hoping to extend the compatibility of the application to FireFox as well, so I guess this wasn't a real solution.
Looks like I'll have to do some messing around with tabbing orders - didn't really want to do that.
Crow-knee
Member
75 Points
15 Posts
Alternatives to HtmlInputFile
Jan 31, 2006 05:53 AM|LINK
Hi all,
I am trying to create a control which will infact mimic the functionality of the HtmlInputFile control. The reason for this is purely visual, but it is a necessity to maintain the sites "look and feel".
I have tried including a transparent HtmlInputFile in my control which visually works, but the inability to exclude the HtmlInputFile's controls from the tab order is causing some problems.
I don't really understand how the HtmlInputFile works so I guess I am looking for some key terms that I can look up and learn from, or ideally a solution or example.
So I suppose :
1) Is there a way of excluding the HtmlInputFile from the tab order?
2) How does HtmlInputFile add into the HttpContext.Current.Request.Files collection?
3) How can the script "popup" the file selection dialogue box?
Thanks for any help on this,
Steele.
KHenriksson
Member
80 Points
16 Posts
Re: Alternatives to HtmlInputFile
Jan 31, 2006 01:42 PM|LINK
orzeh
Contributor
4993 Points
897 Posts
Re: Alternatives to HtmlInputFile
Jan 31, 2006 03:06 PM|LINK
only by JavaScript (see onFocus event).
HttpContext.Current.Request.Files contains data posted to server from client`s form. HtmlInputFile renders to <input type="file"> tag, so the browser send selected file via HTTP protocol.
document.getElementById( 'file_inpu_id' ).click();
but it is supported only in IE.
hope it helps
orzeh
Crow-knee
Member
75 Points
15 Posts
Re: Alternatives to HtmlInputFile
Jan 31, 2006 09:50 PM|LINK
Thanks for the information. Very helpful... but also confirms what I feared.
I have tried out the document.getElementById( 'file_inpu_id' ).click(); method, but had no luck, getting the error :
htmlfile: Access is denied.
with the debugger pointing to the theform.submit(); in the html postback script. I'm running XP SP2 if that makes a difference. But I am hoping to extend the compatibility of the application to FireFox as well, so I guess this wasn't a real solution.
Looks like I'll have to do some messing around with tabbing orders - didn't really want to do that.
Thanks again for the help.
Steele.