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 8169747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:56:38+00:00 2026-06-06T20:56:38+00:00

I want to allow users to drag and drop (or select) a file from

  • 0

I want to allow users to drag and drop (or select) a file from their computer and load it into a textbox with JavaScript.

Is it possible to load a local file with JavaScript into a textbox? If yes, then how?

  • 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-06-06T20:56:40+00:00Added an answer on June 6, 2026 at 8:56 pm

    I think everything you would want for HTML5 is included in remy/html5demos on github.

    As an example, I modified http://html5demos.com/file-api to accept text files and display them in the browser.

    See the jsfiddle.

    Edit
    Relevant script:

    // modified from http://html5demos.com/file-api
    var holder = document.getElementById('holder'),
        state = document.getElementById('status');
    
    if (typeof window.FileReader === 'undefined') {
        state.className = 'fail';
    } else {
        state.className = 'success';
        state.innerHTML = 'File API & FileReader available';
    }
    
    holder.ondragover = function() {
        this.className = 'hover';
        return false;
    };
    holder.ondragend = function() {
        this.className = '';
        return false;
    };
    holder.ondrop = function(e) {
        this.className = '';
        e.preventDefault();
    
        var file = e.dataTransfer.files[0],
            reader = new FileReader();
        reader.onload = function(event) {
            console.log(event.target);
            holder.innerText = event.target.result;
        };
        console.log(file);
        reader.readAsText(file);
    
        return false;
    };​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a web-app that will allow users to drag and drop from a
As shown from the diagram above, I only want to allow users to drag
I want to allow users to make their own Python mods for my game,
I want to allow users to select a local directory on a webpage (and
I have a DataGridView, where I allow users to Drag/Drop rows to reorder them.
I want to allow dropping of image files in my application: Users can Drag
I want to allow users to use their own stylesheets for thei profiles on
I want to allow user to drag and drop UI elements. I've 'container' and
I want to allow a user to drag my Win32 window around only inside
I want to allow users of my application to add sub-users and set privileges

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.