×

Discussion Board

Results 1 to 3 of 3

Thread: Image Uploads

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    3

    Image Uploads

    Hi!

    I am trying my darnedest to write an image uploading app in J2ME with absolutely no java experience (I have lots of programming experience, just not java )<-- thats a sad face and a close bracket, not a man with a big mouth

    I have got an image uploading script that i found online working (it seems) but on the web server end the bit that "receives" the file is written in jsp which again I have no experience in, and even worse, my hosting company doesn't support. So I am looking to write the script in php. Anyone keen to lend me a hand? I will owe you big time

    I have had a look at the image upload class on the nokia forum (this one)but I haven't got a clue where to start with that either. Any help with that would also be much appreciated. Save a whale, plant a tree, help a noob!

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Image Uploads

    You can use this PHP script to receive the image on your server which supports PHP.

    http://www.w3schools.com/php/php_file_upload.asp
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    3

    Re: Image Uploads

    Thanks very much for the reply. So is the form posted like a normal php form would be?
    So I can recover the files something like:

    $_FILE['fileName']?

    Thats great news!
    Is this the java that's sending the files to the webserver:

    Code:
    String fileName = pictureURI.getString().substring(pictureURI.getString().lastIndexOf('/'));
    ....
    ..
    .
    
    display.setCurrent(createScreenProgress("Uploading...", 100));
          
             MultipartHttpConnection mhc;
             if(username == null || username.equals(""))
                mhc = new MultipartHttpConnection(uploadURL, progress);
             else
                mhc = new MultipartHttpConnection(uploadURL, progress, username, password);
          mhc.addImg(rawImage, fileName, textLabel.getString());
          response = mhc.send();
    
    if(response.indexOf("success") != -1)
          {
             String fileSize = response.substring(response.lastIndexOf('|'));
             messageField.setText(fileName.substring(1) + " (" + fileSize + "kb) uploaded successfully");
          }
          else if(response.indexOf("fail") != -1)
          {
             messageField.setText("Upload failed: " + response);
          }
          else
          {
             messageField.setText("Something happened... " + response);
          }
          
          display.setCurrent(detailsForm);
    Is the file fields variable name fileName?
    Also, where would the 'form' name be set?

    Thanks so much for your help, this forum is the best!

Similar Threads

  1. Images, Videos and Uploads
    By pcardoso in forum Symbian
    Replies: 2
    Last Post: 2009-12-14, 12:11
  2. Urgent-accessing a new image from the prev image by ptr press in touchscreen
    By dee0dee in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2009-11-12, 08:47
  3. Series 40 - image resizeing and drawing black and white only a part of an image
    By ionutianasi in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2003-07-21, 10:36
  4. Replies: 0
    Last Post: 2003-05-12, 17:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×