<< 关于ConcurrentModificationException异常 | 首页 | 我收藏的链接(28) >>

如何用WAP蜂窝电话上传文件

Upload File from WAP Cell Phone
Many wireless devices like cell phones can be used as a digital camera or as a music player. With them, you can take pictures, record video clips and listen to your favorite MP3 songs at any time and in any place.

However, your cell phone may not have enough space to store all your pictures, video clips, music files, ringtones, etc. To solve this, you can upload some files to a server through a WAP connection. When you need them, you can download them back to your cell phone.

For example, if you are traveling in a beautiful country, you will definitely take many photos and record many video clips with your cell phone. You can upload some of the image files and video files to a server to share with your friends and at the same time make room for more photos and videos along the journey.

Some cell phones support both file upload and 3G wireless network. The upload speed will be very fast if you are using a 3G connection.


How to Upload Files from WAP Cell Phones

Both WML (the markup language of WAP 1.x) and XHTML MP (the markup language of WAP 2.0) do not support file upload. But fortunately the browser on some WAP 2.0 cell phones support the <input type="file"> element as an extension of XHTML MP. Some HTML-capable WAP browsers also support the <input type="file"> element.

The <input type="file"> element will be rendered as a button on a WAP browser. When it is clicked, the list of files stored on the wireless device and the memory card will be displayed. You can then choose a file to upload to the server.

At the server-side, you use a server-side technology like ASP / ASP.NET, ColdFusion, Java Servlet / JSP, Perl and PHP to extract the file from the HTTP request, just like what you will do to handle HTML file upload. Then you can process the file or save it to a directory or a database system.


Nokia Cell Phones that Support WAP Upload

Below shows some of the cell phone models from Nokia that support WAP upload at the time of writing (last updated: 23 Nov 2006). If you know a cell phone model (of any brand) that supports WAP upload but is not listed in the following table, you may report to us using the feedback form at the end of this web page.


Nokia cell phone model

Platform

Nokia 2650

Series 40 Platform 1st Edition

Nokia 3200

Series 40 Platform 1st Edition

Nokia 3220

Series 40 Platform 2nd Edition

Nokia 3250

S60 Platform 3rd Edition (formerly called Series 60)

Nokia 5140

Series 40 Platform 2nd Edition

Nokia 6020

Series 40 Platform 2nd Edition

Nokia 6021

Series 40 Platform 2nd Edition

Nokia 6030

Series 40 Platform 2nd Edition

Nokia 6060

Series 40 Platform 2nd Edition

Nokia 6070

Series 40 Platform 2nd Edition

Nokia 6101

Series 40 Platform 2nd Edition

Nokia 6103

Series 40 Platform 2nd Edition

Nokia 6111

Series 40 Platform 2nd Edition

Nokia 6112

Series 40 Platform 2nd Edition

Nokia 6125

Series 40 Platform 3rd Edition

Nokia 6131

Series 40 Platform 3rd Edition

Nokia 6136

Series 40 Platform 3rd Edition

Nokia 6170

Series 40 Platform 2nd Edition

Nokia 6220

Series 40 Platform 1st Edition

Nokia 6230

Series 40 Platform 2nd Edition

Nokia 6230i

Series 40 Platform 2nd Edition

Nokia 6233

Series 40 Platform 3rd Edition

Nokia 6270

Series 40 Platform 3rd Edition

Nokia 6280

Series 40 Platform 2nd Edition

Nokia 6282

Series 40 Platform 3rd Edition

Nokia 6630

S60 Platform 2nd Edition Feature Pack 2 (formerly called Series 60)

Nokia 6680

S60 Platform 2nd Edition Feature Pack 2 (formerly called Series 60)

Nokia 6681

S60 Platform 2nd Edition Feature Pack 2 (formerly called Series 60)

Nokia 6682

S60 Platform 2nd Edition Feature Pack 2 (formerly called Series 60)

Nokia 6810

Series 40 Platform 1st Edition

Nokia 6820

Series 40 Platform 1st Edition

Nokia 6822

Series 40 Platform 2nd Edition

Nokia 7200

Series 40 Platform 1st Edition

Nokia 7250i

Series 40 Platform 1st Edition

Nokia 7260

Series 40 Platform 2nd Edition

Nokia 7270

Series 40 Platform 2nd Edition

Nokia 7360

Series 40 Platform 2nd Edition

Nokia 7370

Series 40 Platform 3rd Edition

Nokia 7380

Series 40 Platform 3rd Edition

Nokia 7600

Series 40 Platform 1st Edition

Nokia 8800

Series 40 Platform 2nd Edition

Nokia 9300

Series 80 Platform 2nd Edition

Nokia 9500

Series 80 Platform 2nd Edition

Nokia E60

S60 Platform 3rd Edition (formerly called Series 60)

Nokia E61

S60 Platform 3rd Edition (formerly called Series 60)

Nokia E70

S60 Platform 3rd Edition (formerly called Series 60)

Nokia N70

S60 Platform 2nd Edition Feature Pack 3 (formerly called Series 60)

Nokia N71

S60 Platform 3rd Edition (formerly called Series 60)

Nokia N72

S60 Platform 2nd Edition Feature Pack 3 (formerly called Series 60)

Nokia N73

S60 Platform 3rd Edition (formerly called Series 60)

Nokia N80

S60 Platform 3rd Edition (formerly called Series 60)

Nokia N90

S60 Platform 2nd Edition Feature Pack 3 (formerly called Series 60)

Nokia N91

S60 Platform 3rd Edition (formerly called Series 60)

Nokia N92

S60 Platform 3rd Edition (formerly called Series 60)

Nokia N93

S60 Platform 3rd Edition (formerly called Series 60)



The following example demonstrates how to upload a file from a Nokia 6230 cell phone. Here is the XHTML MP document of the example. As XHTML MP is compatible with HTML/XHTML, this XHTML MP document can also be opened with web browsers such as Microsoft Internet Explorer and Mozilla Firefox.


(uploadFileEg1.xhtml)

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>File Upload Example</title>
  </head>

  <body>
    <h1>Welcome to our photo album.</h1>

    <form action="file_upload.php" method="post" enctype="multipart/form-data">
      <p><br/>
        Choose a photo to upload to the WAP server:
        <input name="myFile" type="file"/><br/>
        On the WAP server, save the file as: (Enter something here if you want the file to be saved in a different file name.)
        <input name="filename" type="text"/>
      </p>

      <hr/>

      <p>
        <input type="submit"/>
        <input type="reset"/>
      </p>
    </form>
  </body>
</html>


The above XHTML MP document enables the user to choose a photo to upload and specify a different name for the file if he/she wants to do so.

If you have read our XHTML MP tutorial, the tags and attributes in the above XHTML MP document should be very familiar to you, with the exception of the enctype attribute of the <form> tag. The enctype attribute is used to specify how the form data should be encoded in the HTTP request when the method attribute value is post. The default value of the enctype attribute is "application/x-www-form-urlencoded". It has to be changed to "multipart/form-data" to enable file upload.

In most cases, that's all we need to know about "multipart/form-data" since we will not parse the form data encoded in HTTP requests ourselves but to use functions provided by a server-side technology. Writing the functions by our own is error-prone and is not recommended. If you need to learn the details of the "multipart/form-data" format, please refer to the Form-based File Upload in HTML (RFC 1867) document.

Note that the above XHTML MP document does not conform to the XHTML MP specification since "file" is not a valid value of the type attribute of the <input> tag in standard XHTML MP. Thus, the document cannot pass the check of an XHTML MP validator.

标签 :



发表评论 发送引用通报