PrepAway - Latest Free Exam Questions & Answers

Which two actions should you perform?

You develop an HTML5 application that allows users to upload files from their local computers.
The user interface must remain responsive during the upload.
You need to implement the file upload functionality for the application.
Which two actions should you perform? (Each correct answer presents a complete solution. Choose two.)

PrepAway - Latest Free Exam Questions & Answers

A.
Use an HTML form with a file type INPUT element that targets a hidden IFRAME element.

B.
Use a file type INPUT element, and then use the Web Storage API to upload the file.

C.
Use a FormData object and upload the file by using XMLHttpRequest.

D.
Register the file protocol by using protocol handler registration API and then upload the file by
using XMLHttpRequest.

E.
Use the FileSystem API to load the file, and then use the jQuery post method to upload the file to
the server.

Explanation:

B: Example (notice the web storage api upload.aspx):

<!DOCTYPE html>
<html>
<head>
<title>Upload Files using XMLHttpRequest - Minimal</title>
</head>
<body>
<form id="form1" enctype="multipart/form-data" method="post" action="Upload.aspx">
<div class="row">
<label for="fileToUpload">Select a File to Upload</label>

<input type="file" name="fileToUpload" id="fileToUpload" onchange="fileSelected();"/>
</div>
<div id="fileName"></div>
<div id="fileSize"></div>
<div id="fileType"></div>
<div class="row">
<input type="button" onclick="uploadFile()" value="Upload" />
</div>
<div id="progressNumber"></div>
</form>
</body>
</html>

D:
* Because we’re using XMLHttpRequest, the uploading is happening in the background. The page the
user is on remains intact. Which is a nice feature to have if your business process can work with it.

* The XMLHttpRequest object has gotten a facelift in the Html5 specifications. Specifically the
XMLHttpRequest Level 2 specification (currently the latest version) that has included the following
new features:
Handling of byte streams such as File, Blob and FormData objects for uploading and downloading
Progress events during uploading and downloading
Cross-origin requests
Allow making anonymous request – that is not send HTTP Referer
The ability to set a Timeout for the Request

13 Comments on “Which two actions should you perform?

  1. rik says:

    Page 72 of the Exam Ref 70-480:
    “Web Storage is implemented as name value pairs and stored as strings. Any data that you can put into a string format can be stored in Web Storage.”

    Web storage being session storage and local storage. Since no other types of web storage are discussed in either the Exam ref or the training guide, this would let one to believe it to be pretty hard to send files with it to a server.

    The explanation for answer B states:
    “B: Example (notice the web storage api upload.aspx)”

    No matter how long I stare at it, I still don’t notice any Web Storage API




    2



    0
  2. Thomas says:

    Hey Guys, got some questions:
    – Even if C & E is right, is that what microsoft want me here to answer?
    – or is the green highlighted answer they want me to give?
    – or if not where comes the green answers from?




    0



    0
  3. Po says:

    @Thomas: I don’t know how the green answers are selected, but I’m not sure B/D is what MS would want you to answer since they’re wrong. Re B: webstorage (ie localStorage, sessionStorage) in no way help to upload files. Re D: you cannot register a handler for the file:// protocol anyway, this protocol is not permitted to be handled by application code (see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler). C and E are the technically correct combinations, although the part in E re “use the jQuery post method” implies you would not need to construct the request body payload using FormData anyway as jQuery will do that for you, so really E is the only required answer.




    1



    0
  4. kaggelpiep says:

    Thanks people. I am currently studying for 70-480 and it is INCREDIBLY FRUSTRATING AND ANNOYING to see that several answers of these test exams are plain wrong and do not make any sense at all! This causes great confusion because you are starting to doubt yourself and this is absolutely killing when preparing for an exam. C and E was also the answer I came up with and the test exam came up with the wrong answer B and D which do not makes any sense at all. Good to see several people here came up with that answer as well.

    This is not only the case with the free exams but also with the most recent PAID PREMIUM 70-480 exam from exams4all.com and examcollection.com, which is supposed to be 100% verified. Well, it’s not! I have submit complaints to both these sites and asked for additional verification because they are not living up to what they are advertising.




    3



    0

Leave a Reply