The image is uploaded to the server in the background, but how is it displayed on the front-end? is it a code problem?

Source: Internet
Author: User
The image is uploaded to the server in the background, but how is it displayed on the front-end? is it a code problem? If (empty ($ _ GET [submit])
{
?>

} Else {
$ Path = "uploadfile/"; // Upload path
// Echo $ _ FILES ["filename"] ["type"];
If (! File_exists ($ path ))
{
// Check whether the folder exists. if not, create the folder and grant the highest permission.
Mkdir ("$ path" 0700 );
} // END IF
// File format that can be uploaded
$ Tp = array ("image/gif" "image/pjpeg" "image/jpeg" "image/png ");
// Check whether the uploaded file is of the allowed Upload type
If (! In_array ($ _ FILES ["filename"] ["type"] $ tp ))
{
Echo "File Type is incorrect ";
Exit;
} // END IF
If ($ _ FILES ["filename"] ["name"])
{
$ File1 = $ _ FILES ["filename"] ["name"];
// $ File2 = $ path. time (). $ file1;
// Obtain the original file name.
$ File2 = $ path. $ file1;
$ Flag = 1;
} // END IF
If ($ flag) $ result = move_uploaded_file ($ _ FILES ["filename"] ["tmp_name"] $ file2 );
// Note that the first parameter passed to move_uploaded_file is the temporary file uploaded to the server.
If ($ result)
{
// Echo "Upload successful! ". $ File2;
Echo"

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.