Hello,
using phonegap 0.9.6
device: Blackberry curve 8520
OS 5.
My target is to allow the user to select img or video and send it to the server.
So I pass the file's path to readAsDataURL(path) to read it and send the result to the server.
I success in doing that with PhoneGap FileReader API but the problem arise is that when I try to upload img larger than 3.1 Mega the File has not been read in memory.
so I decide to not read the whole file in memory, instead I'll get a slice of the file then read it and upload it to server then get the next slice of file and upload it and so on till the end of file.
I success in donig that in a web page running in chrome browser in my desktop but I couldn't do that in Blackberry.
This is my code.
input type="file" id="files" name="files"/
var files = document.getElementById('files').files;
// in this point the file variable is undefined so it fail to do the rest of code ??!!
var file = files[0];
//loop till the End of File
{
var blob = file.slice(beginIndex, endIndex);
fileReader.readAsDataURL(blob);
// send the result to server
}
Could any one explaibn to me why readAsDataURL can't read files larger than 3.1 miga, is that related to device memory?
and how could I make slice method which in File API works?
using phonegap 0.9.6
device: Blackberry curve 8520
OS 5.
My target is to allow the user to select img or video and send it to the server.
So I pass the file's path to readAsDataURL(path) to read it and send the result to the server.
I success in doing that with PhoneGap FileReader API but the problem arise is that when I try to upload img larger than 3.1 Mega the File has not been read in memory.
so I decide to not read the whole file in memory, instead I'll get a slice of the file then read it and upload it to server then get the next slice of file and upload it and so on till the end of file.
I success in donig that in a web page running in chrome browser in my desktop but I couldn't do that in Blackberry.
This is my code.
input type="file" id="files" name="files"/
var files = document.getElementById('files').files;
// in this point the file variable is undefined so it fail to do the rest of code ??!!
var file = files[0];
//loop till the End of File
{
var blob = file.slice(beginIndex, endIndex);
fileReader.readAsDataURL(blob);
// send the result to server
}
Could any one explaibn to me why readAsDataURL can't read files larger than 3.1 miga, is that related to device memory?
and how could I make slice method which in File API works?

