Tutorial about Uploading Files from WAP Cell Phones


Today cell phones are becoming more and more powerful. Many of them can be used as a digital camera for taking pictures and recording video clips. With a cell phone that supports file upload, you can upload some pictures or video clips to a server, thus saving storage space of your cell phone. In this tutorial, we will provide you information about building a mobile Internet application that accepts file uploads from WAP-enabled cell phones.

We will begin the tutorial with an overview of how to upload files from a WAP cell phone. Then we will provide you an XHTML MP file upload example that works on both mobile browsers and web browsers like IE and Firefox.

At the server-side, a server-side technology is required to handle the HTTP request submitted from the client. ASP / ASP.NET, Java Servlet, JSP, Perl and PHP are some examples of commonly used server-side technologies. In this tutorial, we will cover how to use PHP and Java Servlet / JSP to handle file uploads. The techniques can be applied to both WAP and web applications.

At the end of the tutorial, we will discuss some of the security issues that you should pay attention to.


Table of Contents

1. Upload File from WAP Cell Phone

1.1. Overview

1.2. How to Upload Files from WAP Cell Phones

1.3. Nokia Cell Phones that Support WAP Upload

2. XHTML MP Example Demonstrating File Upload

3. Handling Form-based File Upload with PHP

3.1. Parsing Form Data and Getting Information about the Uploaded File with PHP

3.2. PHP Directives Related to (Large) File Upload

3.3. Checking for Errors

3.3.1. UPLOAD_ERR_INI_SIZE Error Code

3.3.2. UPLOAD_ERR_FORM_SIZE Error Code (Use with the MAX_FILE_SIZE Form Field)

3.3.3. UPLOAD_ERR_PARTIAL Error Code

3.3.4. UPLOAD_ERR_NO_FILE Error Code

3.3.5. UPLOAD_ERR_NO_TMP_DIR Error Code

3.3.6. UPLOAD_ERR_CANT_WRITE Error Code

3.4. Saving Uploaded Files on the File System with PHP (move_uploaded_file() Function)

3.5. Processing Contents of Uploaded Files with PHP

3.6. Retrieving Values of Ordinary Form Fields with PHP

3.7. Example PHP File Upload Script

4. Handling Form-based File Upload with Java Servlet or JSP

4.1. Downloading the Apache Jakarta Commons FileUpload and Commons IO Libraries

4.2. Installing Apache Jakarta Commons FileUpload and Commons IO into a Servlet/JSP Container Like Tomcat

4.3. Checking If an HTTP Request is Encoded in Multipart Format

4.4. Parsing Form Data with Java Servlet / JSP

4.5. Iterating through File Items

4.6. Retrieving Values of Ordinary Form Fields with Java Servlet / JSP

4.7. Getting Information about the Uploaded File with Java Servlet / JSP

4.8. Saving Uploaded Files in the File System with Java Servlet / JSP

4.9. Processing Contents of Uploaded Files with Java Servlet / JSP

4.10. Example JSP File Upload Script

5. Security Considerations of File Upload