Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7504379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:33:11+00:00 2026-05-29T21:33:11+00:00

Using html5 javascript, how do you get the file path when user select the

  • 0

Using html5 javascript, how do you get the file path when user select the file?
I needed the file path to use in this example case:

user upload a file, pause it(I know so far I think only mozilla can do this), and then close the browser and plan to resume the file the next day. I need to know the file path for this file..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T21:33:12+00:00Added an answer on May 29, 2026 at 9:33 pm

    Even if you did have a path (some browsers used to give it to you), there is no way to set the path of a input of type file.

    Therefore, it is not possible to do what you want with plain JS and the DOM.

    I said it wasn’t possible, but now that you asked I do think there is a way, with new File API. The following steps outline what needs to be done, but have in no way been tested, and I don’t expect it to work, it’s just to show you the way, also global variables are bad, it’s just the simplest way to show you. Here’s a good page with examples on using the File API http://www.html5rocks.com/en/tutorials/file/dndfiles/

    First You need an input of type file, then you can use once a user selects a file, you are given access to the File object. http://dev.w3.org/2006/webapi/FileAPI/#dfn-filereader

    <input type="file" id="files" name="files[]" multiple />
    <script>
      var fileBlobs = [];
      function handleFileSelect(evt) {
        var files = evt.target.files; // FileList object
    
        // files is a FileList of File objects. You may now read their contents
        var reader = new FileReader();
        for (var i = 0, f; f = files[i]; i++) {
          fileBlobs.push(reader.readAsBinaryString(f));
        }
      }    
      document.getElementById('files').addEventListener('change', handleFileSelect, false);
    </script>
    

    Second Now you have the content as a binary string. You can use the File API to store the file locally in a way that you can access later using the FileWriter and FileSaver interfaces http://dev.w3.org/2009/dap/file-system/file-writer.html

    var bb = new BlobBuilder();
    bb.appendfileBlobs.(fileBlobs[0]);
    window.saveAs(bb.getBlob(), "test_file");
    

    Third You need to make an Ajax request passing that blob to the server, tracking how much of the upload is complete. http://www.w3.org/TR/XMLHttpRequest/#the-upload-attribute. It doesn’t look like tracking progress can be done on the client. Your may have to poll the server for actual progress. A possible solution to know where to start an interrupted upload is to have upload ids and when you restart an upload, you ask the server how much of the file has been uploaded.

    Sorry I can’t provide a full answer, but this is not an easy problem. The steps I gave you should take you in the right direction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following Java Applet to get the full file path of
The user has just chosen a file for upload using the HTML File input
Im using JavaScript, the HTML5 canvas-element and WebGL to make a simple 3D-game in
HTML5 draft contains an API called EventSource to stream data (notifications) trough javascript using
I'm using this HTML,CSS and Javascript code (in one document together if you want
In the case that the user doesn't have Javascript activated, in order to draw
Using the HTML5 Geolocation API I've ended up with some variables in Javascript that
I am trying to create a chrome extension using HTML5 WebSockets and can't get
I came across this awesome website made in HTML5 and javascript. The heart of
I have an have an html5 offline app. I am using the cache.manifest file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.