Phpunlink delete related question _ PHP Tutorial

Source: Internet
Author: User
Phpunlink deletion problems. Phpunlink deletion problems when deleting images, such as: unlink(abcdef.jpg); this can be deleted normally; however, when the file name is read from the database, fn $ rs [abc] cannot be deleted; unlink ($ fn ); php unlink deletion

When you delete an image

Example: unlink('abcdef.jpg ');

In this way, the deletion is normal;

But the file name cannot be deleted when it is read from the database.

Fn = $ rs ['ABC'];

Unlink ($ fn );

It cannot be deleted. Have you ever encountered such a situation.

Prompt message:

Warning: unlink (user_logo/javasd4d84f383714d5f3.jpg) [function. unlink]: No such file or directory in

------ Solution --------------------

Didn't he make it clear?

No such file or directory does not have such a file or directory

------ Solution --------------------

Error message file does not exist

The path is incorrect.

------ Solution --------------------

Check whether the file exists before deleting it.

Warning: the file or directory does not exist.

If (file_exists ($ fn )){

Unlink ($ fn );

}

------ Solution --------------------

Check your user_logo/directory to see if this file exists in this directory.

If no value exists, delete it and add a judgment.

If (file_exists ($ fn) {// This file exists

// Delete todo

}

Http://www.bkjia.com/PHPjc/820407.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/820407.htmlTechArticlephp unlink deletion issues such as: unlink('abcdef.jpg ') when deleting images; this can delete normal; but the file name cannot be deleted when reading from the database fn = $ rs ['ABC']; unlink ($ fn...

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.