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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:40:15+00:00 2026-06-04T17:40:15+00:00

I have been trying to upload a (zip) file to a remote server programmatically

  • 0

I have been trying to upload a (zip) file to a remote server programmatically using Phonegap in Android mobile. I have tried the FileAPI documentation and the solution found here. But it doesn’t seem to work. However I could successfully upload an image (using the camera and navigator) as described in the examples.

I have a file test.zip in a folder test in the SD Card. I need to upload this file to a remote server.

Any help regarding this would be great.

  • 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-04T17:40:16+00:00Added an answer on June 4, 2026 at 5:40 pm

    I got it working, here is the code that I used

    uploadFile('test.zip', 'Test', 'multipart/x-zip');
    
    function uploadFile(fileName, dirName, fileMime) {
    
        var win = function(r) {
            console.log("Code = " + r.responseCode);
            console.log("Response = " + r.response);
            console.log("Sent = " + r.bytesSent);
            alert(r.response);
        };
    
        var fail = function(error) {
            alert("An error has occurred: Code = " = error.code);
        };
    
        var fileURI;
    
        var gotFileSystem = function(fileSystem) {
            fileSystem.root.getDirectory(dirName, {
                create : false
            }, function(dataDir) {
    
                fileURI = dataDir.fullPath;
                fileURI = fileURI + '/' + fileName;
    
                alert(fileURI);
    
                var options = new FileUploadOptions();
                options.fileKey = "file";
                options.fileName = fileURI.substr(fileURI.lastIndexOf('/') + 1);
                options.mimeType = fileMime;
    
                var params = new Object();
                params.value1 = "test";
                params.value2 = "param";
    
                options.params = params;
    
                var ft = new FileTransfer();
                ft.upload(fileURI,
    
                        // Enter the server url
                        "http://example.com/upload.php", win,
                        fail, options);
    
            }, dirFail);
    
        };
    
        // file system fail
        var fsFail = function(error) {
            alert("failed with error code: " + error.code);
    
        };
    
        // get file system to copy or move image file to
        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFileSystem,
                fsFail);
    
        var dirFail = function(error) {
            alert("Directory error code: " + error.code);
    
        };
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to design a WCF file upload service and am getting
I have been trying to execute a selenium.attachFile command to upload a file- sel.attachFile(dom_locator,/home/xyz/Desktop/tstfl.txt);
I have been trying to upload a .txt to my server via a simple
I have been trying to use an ajax-style file upload component (like the dojox
I have been trying to figure out how to cancel a file upload to
I have been trying to implement a image upload for changing avatar for individual
I am trying to extend the Upload library in CodeIgniter. I have been trying
I have been trying to make a simple Spring project using Eclipse and Maven
I have been trying to figure out a reliable solution in provide a drag-drop-upload
I have been trying to download Heroku software to upload the rails app I

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.