Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 21
Registered: ‎11-24-2010
My Device: Not Specified
My Carrier: T-com

Upload file in widgets does not work

hi,

this is my html code in widgets:

 

<iframe name="upload_iframe" class="invisible" >
    </iframe>
    <form name="surveryform_photo" id="surveryform_photo" action="http://ourserver/servlet" target="upload_iframe" method="post"
        enctype="multipart/form-data" >
        <input type="hidden" id="method" name="method" value="savePhoto"/>
        <input type="hidden" id="callback" name="callback" value=""/>
        <input type="hidden" id="activityID" name="activityID" value=""/>
        <input type="hidden" id="filename" name="filename" value=""/>
        <input type="hidden" id="contentType" name="contentType" value="image/jpeg"/>
        <input type="file" id="photouploadpath" name="photouploadpath" value=""/>
    </form>

 

this is my js code to submit the form:

 

function sendPhoto(){

 

document.surveryform_photo.callback.value = 'test';
    document.surveryform_photo.activityID.value = 'testid';
    document.surveryform_photo.filename.value = 'xxx.jpg';
    document.surveryform_photo.photouploadpath.value = 'file:///store/home/user/camera/20110111_081.jepg';
    document.surveryform_photo.submit();

 

}

 

 

but the server can only receive the parameters such as activityID, filename, callback, but the upload file 'photouploadpath' receive 0 byte.

 

I have tried this code in Pc browser and in blackberry native browser, i select file to upload manually, it works, the server can receive the right file data, only in widgets does not work.

Who has experience could help me?

Thank you!!!

Contributor
Posts: 21
Registered: ‎11-24-2010
My Device: Not Specified
My Carrier: T-com

Re: Upload file in widgets does not work

i know the reason now, but not found solution yet,

because file upload with javascript need set permission for browser, for mozilla it is:

netscape.security.PrivilegeManager.enablePrivilege('UniversalFileRead');

 

but for blackberry widget i have no idea how to set the permission for upload file without manul selecting

Contributor
Posts: 21
Registered: ‎11-24-2010
My Device: Not Specified
My Carrier: T-com

Re: Upload file in widgets does not work

hi, nobody knows?