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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:38:24+00:00 2026-06-13T19:38:24+00:00

I am building a mobile web app using Sencha Touch 2, and I need

  • 0

I am building a mobile web app using Sencha Touch 2, and I need to upload file from the app to Amazon S3, and get the file url from S3.

The PHP part is almost finished, how shall I implement my sencha program to allow user click a button, and open the file dialog, select the file and call the PHP file to upload the file to S3?

Any idea or suggestion is welcomed!!!

  • 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-13T19:38:26+00:00Added an answer on June 13, 2026 at 7:38 pm

    Finally figured it out after two days!

    Yes, it is impossible to use Sencha to access Android file system and upload files.

    I gave up useing Sencha’s camera function ,and used phonegap’s camera and filetransfer function, access the file system, then upload to S3.

    console.log("camera should be called!"); 
            navigator.camera.getPicture(uploadPhoto,
                    function(message) { alert('get picture failed'); },
                    { quality: 50, 
                    destinationType: navigator.camera.DestinationType.FILE_URI,
                    sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY }
                    );
            function uploadPhoto(imageURI) {
                console.log(imageURI);
                var options = new FileUploadOptions();
                options.fileKey="file";
                options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);
                options.mimeType="image/jpeg";
    
                var params = new Object();
                params.value1 = "test";
                params.value2 = "param";
    
                options.params = params;
    
    
                var ft = new FileTransfer();
                ft.upload(imageURI, "http://54.251.39.219/index.php", win, fail, options);
            }
    
            function win(r) {
                console.log("Code = " + r.responseCode);
                console.log("Response = " + r.response);
                console.log("Sent = " + r.bytesSent);
            }
    
            function fail(error) {
                alert("An error has occurred: Code = " = error.code);
            }
    

    The PHP file on server side:

    <?php
    include('image_check.php');
    $msg='';
    if($_SERVER['REQUEST_METHOD'] == "POST")
    {
    echo '<b>S3 File URL:</b>';
    $name = $_FILES['file']['name'];
    $name = $name . '.jpg';
    $size = $_FILES['file']['size'];
    $tmp = $_FILES['file']['tmp_name'];
    $ext = getExtension($name);
    
    if(strlen($name) > 0)
    {
    echo "strlen ok";
    echo "filename is ".$name;
    echo "extension is ".$ext;
    if(in_array($ext,$valid_formats))
    {
    
    if($size<(1024*1024))
    {
    include('s3_config.php');
    //Rename image name. 
    $actual_image_name = time().".".$ext;
    if($s3->putObjectFile($tmp, $bucket , $actual_image_name, 
    
    S3::ACL_PUBLIC_READ) )
    {
    $msg = "S3 Upload Successful.";
    echo 'upload successful!';  
    $s3file='http://'.$bucket.'.s3.amazonaws.com/'.$actual_image_name;
    echo "<img src='$s3file' style='max-width:400px'/><br/>";
    echo '<b>S3 File URL:</b>'.$s3file;
    
    }
    else
    echo "S3 Upload Fail.";
    
    }
    else
    echo "Image size Max 1 MB";
    
    }
    else
    echo "Invalid file, please upload image file.";
    }
    else
    echo "Please select image file";
    
    }
    
    ?>
    

    Note, the file uploaded is without extension, so I need to give it an extension…
    For the S3 configuration, please refer to the S3 official website for things like secretkey…

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

Sidebar

Related Questions

I'm building a mobile web app targeting Android users. I need to know what
I'm building a web app using jquery mobile that will have lots of images
I am building a web app that imports data from data feeds in php/mysql.
I am building a HTML5 based mobile web app for iPhone. I need to
I'm building a web mobile app, using jQuery 1.1.1 and HTML5. I would like
I am building a webapp with jquery mobile where I need to get data
For the web site I'm building (targeted at mobile users) I'm thinking of using
I'm building a mobile interface with JQuery Mobile for an already existing web app
I'm in the process of building a mobile web app, and I've run into
I am building an iPhone app using jQuery Mobile, jQuery 1.7.2, and PhoneGap trying

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.