Pear: HTTP_Upload introduction _ PHP Tutorial

Source: Internet
Author: User
Pear: HTTP_Upload introduction. The HTTP_Upload class library of Pear provides an encapsulated html form file Upload handler that uses the Pear error system. This feature allows you to easily verify the upload of multiple files at a time.

The HTTP_Upload class library of Pear provides an encapsulated html form file Upload handler that uses the Pear error system.

Features
Ability to process multiple files at a time
It is easy to verify the upload status of files and restrict the upload of unwanted files.
Multilingual error message (no Chinese characters yet, but can be expanded)
Example of uploading a single file
Index.htm

PLAIN TEXT
CODE:

Files. php

PLAIN TEXT
PHP:
RequireHTTP/Upload. php;
$ Upload = newHTTP_Upload (es );
// Language for error messages
$ File = $ upload-> getFiles (userfile );
// Return a file object or error
If (PEAR: isError ($ file )){
Die ($ file-> getMessage ());
}
// Check if the file is a valid upload
If ($ file-> isValid () {// this method will return the name of the file you moved,
// Useful for example to save the name in a database
$ File_name = $ file-> moveTo (./uploads_dir /);
If (PEAR: isError ($ file_name )){
Die ($ file_name-> getMessage ());
}
}
?>
Multifile Upload example

PLAIN TEXT
CODE:

PLAIN TEXT
PHP:
$ Files = $ upload-> getFiles (); // returns an array of file objects or error
Foreach ($ filesas $ file ){
If ($ file-> isValid ()){
...
}
}?>
Download
Http://pear.php.net/package/HTTP_Upload

Copyright disclaimer: you can reprint the document at will. during reprinting, you must mark the original source and author information of the article as hyperlinks and this statement.

Published by volcano on September 16, 2006 at am

Copyright information: This information can be reproduced at will. during reprinting, you must mark the original source and author information of the article in the form of hyperlinks and this statement.

Permanent link-http://www.ooso.net/index.php/archives/240

Bytes. It is easy to verify the upload of multiple files at a time...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.