This is a migrated thread and some comments may be shown as answers.

RadAsyncupload on WebView

3 Answers 105 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Luis
Top achievements
Rank 1
Luis asked on 28 Aug 2015, 10:12 PM

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.

3 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Danchev
Telerik team
answered on 02 Sep 2015, 01:43 PM
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
0
Luis
Top achievements
Rank 1
answered on 15 Feb 2016, 02:19 PM
Thanks, that solved my problem.
0
Ivan Danchev
Telerik team
answered on 17 Feb 2016, 07:36 AM
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
Tags
AsyncUpload
Asked by
Luis
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Luis
Top achievements
Rank 1
Share this question
or