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
New Developer
s9ik3
Posts: 11
Registered: ‎11-19-2009

Image upload on my server

Hi , I'm newbie , I wont create a widget for upload image on my server ... Where I can find an tutorial ? Thanks

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,702
Registered: ‎10-16-2008
My Carrier: Rogers

Re: Image upload on my server

You can do this through a multipart/form-data upload.  There should be lots of documents and examples on the web for this functionality.

 

Be sure to white list the domain you will be uploading to in the config.xml file in the <access> element.

 

 

<form action="addImage.jsp" method="post" enctype="multipart/form-data">
    <input type=”file” name=”image_upload”>
    <input type=”submit value=”Upload”>
</form>

 

 

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
New Developer
s9ik3
Posts: 11
Registered: ‎11-19-2009

Re: Image upload on my server

thanks , can you link me any tutorials ? thanks in advance !

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,702
Registered: ‎10-16-2008
My Carrier: Rogers

Re: Image upload on my server

Voila:

http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_FILE.html

 

For other examples Google is your friend :smileyhappy:

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
New Developer
s9ik3
Posts: 11
Registered: ‎11-19-2009

Re: Image upload on my server

hi i'm know html/js/php ... but i don't where i can start for build an widget (bb API and so on ...) :/

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,702
Registered: ‎10-16-2008
My Carrier: Rogers

Re: Image upload on my server

To do what you are looking for, it does not require any specific widget or BlackBerry API knowledge.  Uploading a file from a web page is standard HTML functionality that should work either in a widget or the normal BlackBerry Browser.

 

Do you have a specific question on the widget or BlackBerry API?  I just want to make sure I am addressing your question.

 

Cheers,

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
New Developer
s9ik3
Posts: 11
Registered: ‎11-19-2009

Re: Image upload on my server

well .. i wont build a widget similar a facebook application for upload image.. but i wont upload image by my photocam on my server (upload is protect with a passwd) tnks for all

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,702
Registered: ‎10-16-2008
My Carrier: Rogers

Re: Image upload on my server

Instead of using the form submit, you could always use a method such as AJAX..

 

Here is an example of using AJAX to upload a file:

 

http://www.webtoolkit.info/ajax-file-upload.html

 

You can also set your username and password on your AJAX call for your server's authentication.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Contributor
bubble7th
Posts: 27
Registered: ‎01-20-2011
My Carrier: Developer

Re: Image upload on my server

dear tim, in the http://www.webtoolkit.info/ajax-file-upload.html that u post, the acrtion from is to index.php is that the index.php are include in the application that i build? or the index.php is in another domain? if include, are php can run in blackberry? if not, is this us cross domain? because i already test and open with error : permission denied for <> to get property htmlDocument.location i think the ajax cannot cross domain, i dunno is that true or not thx
---------------------------------------------------------------
Best Regards

William
Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,702
Registered: ‎10-16-2008
My Carrier: Rogers

Re: Image upload on my server

index.php is on the server.  You are not able to package and run php files on a BlackBerry.  In a WebWorks application you can allow cross domain/origin AJAX calls by white listing the domain/origin in the config.xml file in the <access> elements.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.