php3/4.1 Register

Source: Internet
Author: User
Because the early (php3/4.1) UploadFile produces variables that are only
$uploadfile
$uploadfile _name
$uploadfile _size
$uploadfile _type

And now (PHP4.2/3) The resulting variable is
$_files[' uploadfile ' [' Name ']
$_files[' UploadFile ' [' Size ']
$_files[' uploadfile ' [' type ']
$_files[' UploadFile ' [' Temp_name ']
$_files[' uploadfile ' [' Error ']


As the new version of the added error to determine whether the file upload success, and the older versions of the use of
Code:
if (copy ($uploadfile, "newpaht/". $uploadfile _name))

To determine if the file upload was successful, so we discarded the conversion process Error
Relative, because the new version of the discarded $uploadfileSo we have to assign value to this value, and consider the old
Version is used copy so we assign the temporary file path to this variable to coordinate the work.

Code:
<?php
Session_Start ();
$_vars=array (
"_get",
"_post",
"_cookie",
"_session",
"Http_post_vars",
"Http_get_vars",
"Http_cookie_vars",
"Http_session_vars",
"_files",
"_env"
)//Put the relevant variables in the server here
Reset ($_vars);
for ($Tmpa =0; $Tmpa <count ($_vars); $Tmpa + +) {
Extract ($$_vars[$Tmpa], "Extr_prefix_same", $_vars[$Tmpa]);
if (strcmp ($_vars[$Tmpa], "_files") ==0) {
while (list ($key, $value) =each ($$_vars[$Tmpa)) {
${$key. " _name "} =$_files[' $key ' [' name '];
${$key. " _type "} =$_files[' $key '] [' type '];
${$key. " _size "} =$_files[' $key ' [' Size '];
$ $key =${$key. " _tmpname "}=$_files[' $key '] [' tmp_name '];
}
}
}
?>


The above code has been modified to test, can be used normally ...

How to use

Code:
<?php
@include ("pathtothisfile.php");
?>



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.