RadAsyncupload on WebView

4 posts, 1 answers
  1. Luis
    Luis avatar
    3 posts
    Member since:
    Jul 2013

    Posted 28 Aug 2015 Link to this post

    Hello everyone.

    I'm having a problem with an Android app. The app use a webview control to display and navigate a webpage. On the webpage I have a radasyncupload for uploading images. This woks perfectly both on the web page and the app FOR LOLLIPOP(Android 5.1.1).

    My problem happens when I try to upload an image on Jellybean (Android 4.1.2), I'm able to upload the file to the control but when I hit the "Upload" button, that process the images I get the error "Parameter no valid" in the WEBPAGE code line "Bitmap upBmp = (Bitmap)Bitmap.FromStream(CurrentFile.InputStream);"

     

    On the android app, when I hit the file upload bar it calls the following code:

    public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
                    //openFileChooser(uploadMsg, acceptType);
                mUploadMessage = uploadMsg;  
                    Intent i = new Intent(Intent.ACTION_GET_CONTENT);  
                    i.addCategory(Intent.CATEGORY_OPENABLE);  
                    i.setType("image/*");
                    startActivityForResult( Intent.createChooser( i, "File Chooser" ), FILECHOOSER_RESULTCODE );
                }

    And after I choose the file:

     public void onActivityResult (int requestCode, int resultCode, Intent data) {
     
            // code for all versions except of Lollipop
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
     
                if(requestCode==FILECHOOSER_RESULTCODE) {
                    if (null == this.mUploadMessage) {
                        return;
                    }
     
                    Uri result=null;
     
                    try{
                        if (resultCode != RESULT_OK) {
                            result = null;
                        } else {
                            // retrieve from the private variable if the intent is null
                            result = data == null ? mCapturedImageURI : data.getData();
                        }
                    }
                    catch(Exception e) {
                        Toast.makeText(getApplicationContext(), "activity :"+e, Toast.LENGTH_LONG).show();
                    }
     
                    mUploadMessage.onReceiveValue(result);
                    mUploadMessage = null;
                }
     
            } // end of code for all versions except of Lollipop

    ...

     

    It's a very strange problem and every help will be very appreciated.

  2. Answer
    Ivan Danchev
    Admin
    Ivan Danchev avatar
    829 posts

    Posted 02 Sep 2015 Link to this post

    Hello,

    You can try disabling the upload modules and check whether this has any effect.

    Disable Flash and Silverlight  modules:
    <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" DisablePlugins="true" >

    Disable FileApi module:
    Telerik.Web.UI.RadAsyncUpload.Modules.FileApi.isAvailable = function () {
        return false;
    }

    This will make the RadAsyncUpload use the Iframe module and could rule out its involvement in the issue.

    Invalid data is one possible cause for getting the error. You can check the threads on stackoverflow, this one for instance, that discuss the "Parameter not valid" error and suggest potential reasons for getting it and solutions.

    Regards,
    Ivan Danchev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Luis
    Luis avatar
    3 posts
    Member since:
    Jul 2013

    Posted 15 Feb in reply to Ivan Danchev Link to this post

    Thanks, that solved my problem.
  5. Ivan Danchev
    Admin
    Ivan Danchev avatar
    829 posts

    Posted 17 Feb Link to this post

    Hello Luis,

    Thank you for getting back to us. I am glad the issue has been resolved.

    Regards,
    Ivan Danchev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top