Shanghai Grand Rapids medical legend Mandarin PHP upload, manage photos sample

Source: Internet
Author: User
function: Upload photos, display the upload time, image name, image size, picture description.
Description: 1. Some page space may not support the temporary file operation after uploading, it can only be a different try.
2. The program can automatically create new documents Photo.txt and directory image, if not working properly, please create a new document Photo.txt (and upimage.php in the same directory) and directory image.
3. You can test the http://medonline.51.net/upload/upimage.php on my homepage
-



<title>Uploading photos</title>



if ($upload) {//click "Upload" to execute this PHP code section
if ($picurl = = "None") {
echo "You didn't upload any files.";
Exit If the file is not uploaded, exit the program
}
$v =opendir ("image");
if ($v ==0)
{mkdir ("image");//If the directory does not exist, create a new
$v =opendir ("image"); Get catalog Handle
}
$up =copy ("$picurl", "image/$picurl _name"); A critical step to copy the temporary files to the image directory
if ($up ==1)
{
File operations
$FP =fopen ("Photo.txt", "a");//Open file, add to write message
Initialize Write content
$mydate =date ("Y year m D-day h:i A");
$phot//Convert a newline character to

$text = "Photo name: $picurl _name
Photo size: $picurl _size byte
Photo Description:
$photonote
Uploaded by: $user ($mydate) ";
Write content
Fwrite ($fp, $text, strlen ($text)); Strlin Calculating the string length of $text
Fclose ($FP);
echo "File Upload successful!
";
Unlink ($picurl); Delete the archive from the Temp folder $picurl
Closedir ($v); Close directory Handle
}
Else
{echo "File upload failed."; exit;} If the upload fails, exit the program
}
?>














All photos

Show previous upload photo information
ReadFile ("Photo.txt");
?>

Uploading photos


Return



"The copyright of this article is owned by the author and house Orso near net, if need to reprint, please specify the author and source"

The above describes the Shanghai Grand medical legend of the Chinese language PHP upload, management photos examples, including the Shanghai Grand Medical legend of the Chinese language content, I hope to be interested in PHP tutorial friends helpful.

  • Related Article

    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.