How do I access the Request.Files from JavaScript?

This is a real newbe question.  I have an ASP.Net page where I am calling the jQuey dialog from a JavaScript function. Each time the user selects a file I would like to add the file to a simple table on the page.

If I understand the jQuery function correctly it is adding the selected file to Request.Files.  I can access this from VB.Net or C#.  

Is there any way to access the Request object from JavaScript?

 <script type="text/javascript">

        // jQuery Dialog
        $(function () {
                bgiframe: true,
                height: 140,
                modal: true,
                autoOpen: false,
                resizable: false

        function GetCsvFile() {

            // jQuery call to prompt user for a file

            // Want to list all files selected to a simple table on the page...


                <div id="dialog" title="Add CSV File">
                    <form action="/File.mvc/Upload" enctype="multipart/form-data" method="post">
                        <input type="file" id="fileUpload" name="fileUpload" size="23" /></p>
                        <input type="button" id="addFile" name="addFile" value="Add File" onclick="AddSmsCsvToList()" />   <input type="submit" value="Upload" /> </p>

Open in new window

Who is Participating?
JtRConnect With a Mentor Commented:
The file is uploaded via webbrowser, not via Javascript. So the only thing you can get via Javascript is the filename of the input field that you used for selecting the file.

For example if you have an uploader with a progress bar than it checks (on a hidden ajax channel) and a corresponding script on the webserver how many bytes are already transfered.

you can access the file on the webserver only.
accessing local files via javascript is not possible (at least not without reconfiguring the security policy of your webbrowser) - so it is not practically for a "public application" as the user have to configure their browsers to a less secure level.
JtRConnect With a Mentor Commented:
I red my answer and was not sure if you would understand what i mean :D

1. you can only access a file upload on a webserver. the upload managers just FAKING to know how many bytes are uploaded. in real they ask your webserver.

2. you could theoretically read the file whose name is given in the file upload input box, BUT it is not a good idea because you needed to level down your browsers security to allow local file access.
MDKIMZEYAuthor Commented:

Thanks much - I have worked through the issues.  
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.