Ec (2); & lt ;? Php & nbsp; Class & nbsp; upload & nbsp; {& nbsp; var & nbsp; $ upload_name; & nbsp; & nbsp; var & nbsp; $ upload_tmp_address; & nbsp; var & nbsp; $ upload_server _ script ec (2); script
Class upload
{
Var $ upload_name;
Var $ upload_tmp_address;
Var $ upload_server_name;
Var $ upload_filetype;
Var $ file_type;
Var $ file_server_address;
Var $ image_w = 900; // The width of the image to be displayed
Var $ image_h = 350; // The height of the image to be displayed
Var $ upload_file_size;
Var $ upload_must_size = 50000; // specify the size of the file to be uploaded.
Function upload_file ()
{
$ This-> upload_name = $ _ FILES ["file"] ["name"]; // get the Upload file name
$ This-> upload_filetype = $ _ FILES ["file"] ["type"];
$ This-> upload_server_name = date ("Y_m_dH_ I _s"). $ this-> upload_name;
$ This-> upload_tmp_address = $ _ FILES ["file"] ["tmp_name"]; // get a temporary address
$ This-> file_type = array ("image/gif", "image/pjpeg"); // type of the file that can be uploaded
$ This-> upload_file_size = $ _ FILES ["file"] ["size"]; // size of the uploaded file
If (in_array ($ this-> upload_filetype, $ this-> file_type ))
{
If ($ this-> upload_file_size <$ this-> upload_must_size)
{
Echo ("Upload successful, thank you for your support ");
$ This-> file_server_address = "./upload/tx/". $ this-> upload_server_name;
Move_uploaded_file ($ this-> upload_tmp_address, $ this-> file_server_address); // remove from the TEMP directory
Echo ("file_server_address width = $ this-> image_w height = $ this-> image_h/>"); // display the image
}
Else
{
Echo ("the file capacity is too large ");
}
}
Else
{
Echo ("this file type is not supported. Please select again ");
}
}
}
?>
Include (''./lib/wodream/image/image_upload.php '');
$ Dd = new upload;
$ Dd-> upload_file ();
?>
Upload files:
The file type that can be uploaded is: jpg | jpeg | png | pjpeg | gif | bmp | x-png | swf.
Return