// Function name: CheckExtendName ($ C_filename, $ A_extend) // Function: determine the extended name of the uploaded file // parameter: $ C_filename: Uploaded file name // $ A_extend request extended name // returned value: Boolean value // remarks: none // ----------------------- // Function name: CheckExtendName ($ C_filename, $ A_extend)
// For usage: determine the extended name of the uploaded file
// Parameter: $ C_filename: name of the uploaded file
// $ A_extend request extension name
// Return value: Boolean
// Standby Note: None
// Configure //-----------------------------------------------------------------------------------
-------
Function CheckExtendName ($ C_filename, $ A_extend)
{
If (strlen (trim ($ C_filename) <5)
{
Return 0; // returns 0, indicating that no image is uploaded.
}
$ Lastdot = strrpos ($ C_filename, '.'); // retrieves the final position.
$ Extended = substr ($ C_filename, $ lastdot 1); // Retrieve the extended name
For ($ I = 0; $ I {
If (trim (strtolower ($ extended) = trim (strtolower ($ A_extend [$ I]) // Large conversion
Lowercase and detection
{
$ Flag = 1; // The flag is successfully added.
$ I = count ($ A_extend); // if it is detected, the detection ends.
}
}
If ($ flag <> 1)
{
For ($ j = 0; $ j {
$ Alarm. = $ A_extend [$ j]. '';
}
AlertExit ('upload only '. $ alarm.' file! And you uploaded '. $ extended.' type File ');
Return-1; // return-1 indicates that the type of the uploaded image is inconsistent.
}
Return 1; // return 1 indicating that the image type meets the request
}
// Configure //-----------------------------------------------------------------------------------
-------
// Configure //-----------------------------------------------------------------------------------
-------
// Function name: CheckImageSize ($ ImageFileName, $ LimitSize)
// Usage: check the size of the uploaded image
// Parameter: name of the image uploaded by $ ImageFileName
// $ LimitSize requested size
// Return value: Boolean
// Standby Note: None
// Configure //-----------------------------------------------------------------------------------
-------
Function CheckImageSize ($ ImageFileName, $ LimitSize)
{
$ Size = GetImageSize ($ ImageFileName );
If ($ size [0]> $ LimitSize [0] │ $ size)
{
AlertExit ('large Image size ');
Return false;
}
Return true;
}
// Configure //-----------------------------------------------------------------------------------
-------
// Configure //-----------------------------------------------------------------------------------
-------
// Function name: Alert ($ C_alert, $ I _goback = 0)
// Usage: illegal control warning
// Parameter: $ C_alert (error message)
// $ I _goback (return to that page)
// Return value: string
// Standby Note: None
// Configure //-----------------------------------------------------------------------------------
-------
Function Alert ($ C_alert, $ I _goback = 0)
{
If ($ I _goback <> 0)
{
Echo 'script alert ('$ C_alert'); history. go ($ I _goback); script ';
}
Else
{
Echo 'script alert ('$ C_alert'); script ';
}
}
// Configure //-----------------------------------------------------------------------------------
-------
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