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

Posts: 15
Registered: ‎05-19-2011
My Device: Storm2 9550
My Carrier: Student

Problem with "C:\fakepath"

Hi.. I have an app that allow to select a file (image) and then show it on the screen


My problem is on recent browsers the path of the file is hidden by the "C:\fakepath" sentence... i.e "C:\fakepath\image.jpg"


I need the absolute path because I have to read the file and then show it like


<img name="image" id="image" src= "data:image/jpg;base64,[...data...]"/>


But i can't open the file because i can't get the absolute path...



Then I proved to send the image to a server and then received the blob data again..


<form name="form" method="post" action="upload.php">
<input type="file" id="uploadedfile" name="uploadedfile"/>
<input type=hidden name="fileid" id="fileid" value="123"></input>
<input type="button" onclick="upload()" value="presiona"/>


function upload(){

But it takes me to a new page (a blank page because server is not sending a response by now)  from server and I can't go back to the application again..


Please.. I will be very thankfully  if you can help me to find a solution..








Posts: 163
Registered: ‎05-06-2011
My Device: Playbook
My Carrier: Not Specified

Re: Problem with "C:\fakepath"

If you are selecting the image from the shared location then there is a constant value for the filepath exculding the filename. You could fix a constant for this path. And then append your filename to this path. Filename can be obtained like below on the file onchange event


var imagesrc=document.getElementById("fileType").value;
var imageName = imageSrc.split("fakepath");

where fileType is file type tag id and  imageName[1] gives you the filename. In case of Playbook the constant path is 'file:///accounts/1000/shared/camera'


Posts: 131
Registered: ‎03-25-2009
My Device: Z30
My Carrier: Telus

Re: Problem with "C:\fakepath"

 I  am trying to do the exact same thing.  


If I have the following in my config.xml file:


But I still get fakepath back when i get the value of the input, though the input displays the real path to the user.


Should I not have access to the full file path?But it is possible the user is selecting a a text file as well. If they select a text file I would like to be able to read the text file and show a preview of it's content.


Does developing a webworks app prevent me from all filesystem access?


Does the <rimSmiley Tongueermissions> tag work with ripple? I don't see that section showing up in the config validator in ripple (lower right had corner).