Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 将Blackberry WebWorks SDK摄像头中的图像发布到PHP文件服务器_Image_Blackberry_Upload_Camera - Fatal编程技术网

Image 将Blackberry WebWorks SDK摄像头中的图像发布到PHP文件服务器

Image 将Blackberry WebWorks SDK摄像头中的图像发布到PHP文件服务器,image,blackberry,upload,camera,Image,Blackberry,Upload,Camera,我正在使用Blackberry webworks我想将图像从摄像头上传到php Web服务器我正在获取uri中的图像,它显示正确,但我不知道如何将图像上传到服务器请帮助 文件uri file://dir/image 名字 我使用的代码来自blackberry webworks摄像头api function takePicture() { try { blackberry.med

我正在使用Blackberry webworks我想将图像从摄像头上传到php Web服务器我正在获取uri中的图像,它显示正确,但我不知道如何将图像上传到服务器请帮助

文件uri file://dir/image 名字

我使用的代码来自blackberry webworks摄像头api

function takePicture() {
                            try {
                                blackberry.media.camera.takePicture(photoTaken, closedCB, errorCB);
                            } catch (e) {
                                //alert("Error in supported: " + e);
                            }
                        }

                        function successCB(filePath) {

                            var file = "file://" + filePath;
                            $("#myfileCam").val(file);
                            $("#imgPic").show();
                            $("#imgPic").attr("src", file);

                        }

                        function photoTaken(filePath) {

                            var img = new Image();
                            img.src = "file://" + filePath;
                            img.width = Math.round(screen.width / 2);
                            document.getElementById("path").appendChild(img);
                            var html = "<input type='file' name='myfile' id='myfile' value='file://" + filepath + "' />";
                            document.getElementById("fileup").innerHTML = html;
                            //$("#fileup").html();  
                            $("#myfileCam").val("file://" + filePath);

                        }

                        function closedCB() {
                            // alert("Camera closed event");
                        }

                        function errorCB(e) {
                            alert("Error occured: " + e);
                        }

Blackberry Webworks使用Phonegap我也遇到了同样的问题,我用这个api解决了这个问题

这是你需要的一切

您需要做的唯一一件事是将phonegap jar文件放在ext文件夹中,并在config.xml中调用权限,添加此功能phonegap,然后将其删除


我希望这对你有用,对我有用。

从图像中获取图像数据并将数据发送到服务器。你有什么特别的例子吗?谢谢,我正在使用blackberry webworks,并且只使用javascript。
FileConnection fc= (FileConnection)Connector.open(filePath);
InputStream is=fc.openInputStream();
                    byte[] ReimgData = IOUtilities.streamToBytes(is);
                    EncodedImage encode_image =EncodedImage.createEncodedImage(ReimgData, 0, (int)fc.fileSize());
                    JPEGEncodedImage encoder=JPEGEncodedImage.encode(encode_image.getBitmap(),50);
                    byte[] array=encoder.getData();
                    // Decodes the image represented by this EncodedImage and returns a Bitmap
                    int length=array.length;
                    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(length);
                    Base64OutputStream base64OutputStream = new Base64OutputStream( byteArrayOutputStream );
                     try{
                                     base64OutputStream.write( array, 0, length );
                                     base64OutputStream.flush();
                                     base64OutputStream.close();
                                 }
                                    catch (IOException ioe){
                                    //Dialog.alert("Error in encodeBase64() : "+ioe.toString());
                                    System.out.println("Error in encodeBase64() : "+ioe.toString());

                                 }


 data = Base64InputStream.decode(byteArrayOutputStream.toString());