0

I use jquery mobile and PhoneGap.

I have several images files , and I want to sent to the server in a directory

my pictures are stored on my Phone

4

2 に答える 2

0

Create a web service in the technology of your liking, grant write access on the server, and then for each image file have your PhoneGap application send the image bytes to the server, along with metadata such as the filename and owner.

于 2013-02-18T16:01:48.020 に答える
0

FileTransfer is an object that allows you to upload files to a server or download files from a server and it is included in the Apache Cordova API Reference. In my opinion the usage of FileTransfer object is the proper way to upload the files to the remote server.

If you check the implementation of the FileTransfer class inside the Apache Cordova jar you will see that the signature of the upload method is:

    /**
     * Uploads the specified file to the server URL provided using an HTTP multipart request.
     * @param source        Full path of the file on the file system
     * @param target        URL of the server to receive the file
     * @param args          JSON Array of args
     * @param callbackContext    callback id for optional progress reports
     *
     * args[2] fileKey       Name of file request parameter
     * args[3] fileName      File name to be used on server
     * args[4] mimeType      Describes file content type
     * args[5] params        key:value pairs of user-defined parameters
     * @return FileUploadResult containing result of upload request
     */
    private void upload(final String source, final String target, JSONArray args, CallbackContext callbackContext) throws JSONException {

This means that the method expects to receive as it's first argument, a single source string (which represents the full path of the file on the file system) and not an array of strings.

Therefore in case you select to go on with the FileTransfer option maybe the multiple FileTransfer upload calls are inevitable.

于 2013-02-18T21:11:33.737 に答える