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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:04:17+00:00 2026-05-22T18:04:17+00:00

I see this article explaining how to upload a file using client API’s from

  • 0

I see this article explaining how to upload a file using client API’s from a fully trusted app.

How to implement such functionality but from javascript?

For example, I have this code in which I have both the local path of the file and the SharePoint doc lib, how do I complete it?

Thanks!

PS: I’m guessing there must be some fully trusted component involved in the client in order to achieve this, otherwise would be a javascript security hole, but which one would be the right one to use in this case against SharePoint?

    <script type="text/javascript">
        var list;
        var filePath;
        function ShowUploadDialog() {
            // get file path user chooses through a dialog
            var fileDialog = document.getElementById("fileDialog");
            fileDialog.click();
            filePath = fileDialog.value;

            // get list
            var context = new SP.ClientContext.get_current();
            var site = context.get_site();
            var web = site.get_rootWeb();
            this.collList = web.get_lists();
            list = collList.getByTitle("My doc library");
            context.load(list);
            context.executeQueryAsync(Succeeded, Failed);
        }
        function Succeeded(sender, args) {
            // I HAVE HERE THE list AND THE filePath, HOW CAN UPLOAD THE FILE TO THE LIST?
        }
        function Failed(sender, args) {
            alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace());
        }
    </script>
  • 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-22T18:04:17+00:00Added an answer on May 22, 2026 at 6:04 pm

    UploadCtl solves this.

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

Sidebar

Related Questions

I see this all the time in Ruby: require File.dirname(__FILE__) + /../../config/environment What does
I see this from time to time and want to know what it is.
As you can see this is a question from a non web developer. I
When I access my site from any computer, I see this warning popping up:
First let me say that I did see this article: How to remove AspxAutoDetectCookieSupport
I see many, many sites that have URLs for individual pages such as http://www.mysite.com/articles/this-is-article-1
I see this often in the build scripts of projects that use autotools (autoconf,
I see this in a stack trace: myorg.vignettemodules.customregistration.NewsCategoryVAPDAO.getEmailContentByID(I)Lmyorg/pushemail/model/EmailContent; What does the (I)L mean?
In a webservice I see this code: <WebMethod()> _ Public Function dosomething() As Boolean
For some reason I never see this done. Is there a reason why not?

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.