Skip to main content

We want to use HTML5 capabilities to upload files via xmlhttprequest.

in javascript we are able to browse fiels or drag & drop files, the missing part we would like to know is

how to access the document in the controller, this is our code so far.

VisualForce Page:

           var formData = new FormData();

 

            formData.append("myfile", file);

 

 

             var xhr = new XMLHttpRequest();

 

 

              xhr.onreadystatechange = function(e) {

 

                    if (xhr.readyState == 4) {

 

                        Output("readyState: " + xhr.readyState);

 

                        Output("<br/>");

 

                        Output("status: " + xhr.status);

 

                      }

 

                };

 

 

                alert(' start upload: ' + file.name);

 

               

 

                xhr.open("POST", "/apex/vf_DragAndDrop?          

                                      core.apexpages.devmode.url=1&objectId=003M000000MCQJc", true);

 

                xhr.setRequestHeader("X_FILENAME", file.name);

 

                xhr.send(formData);

 

 

How do we access the document in the controller.....

TIA

1 risposta
0/9000