Javascript-when a user posts an application in development, the user uploads an image asynchronously, but the final post is not published, will the uploaded image be useless? How can this problem be solved?

Source: Internet
Author: User
During User posting and application development, the user uploads images asynchronously, but the final post is not published, so it is useless to upload the images. How can this problem be solved? During User posting and application development, the user uploads images asynchronously, but the final post is not published, so it is useless to upload the images. How can this problem be solved?

Reply content:

During User posting and application development, the user uploads images asynchronously, but the final post is not published, so it is useless to upload the images. How can this problem be solved?

Idea: perform special attachment management in the background. Associate an image with a post. If the post is not published successfully, it means that the uploaded image is not associated with the post, and then delete the image. You should always pay attention to attachments. Many people use this vulnerability to publish illegal images and then call them from your server. This may cause you to spread the event.

The user uploads images in a temporary directory.moveOrcopyTo another directory, and then the server hasshellThe temporary directory is cleaned regularly. I wonder if this answer is satisfactory?

In this case, we should consider whether the server processes the uploaded files in the cache or in the directory.
Logically, users are generally given the chance to choose a draft box.

The reason why an image is uploaded asynchronously (indicating that the image has been uploaded successfully) is to use the image, indicating that you have already obtained the image path. Post publishing is a submission process, if a post is not published, it means that the post is not submitted successfully. If the post is not submitted successfully, you can do something (for example, delete the image in the corresponding path). This is just an idea, you can try it.

The server script regularly checks the deletion, or you can record it and request the server to delete it at a specific time.
Generally, it's okay to upload a few images.

IOS FAQ community answers for you
426981364 (group deduction)

After reading the answer from the upstairs, I felt that I had a lot of ideas. My previous practice was to store images in the database, and then regularly run the "Cheng Xun" delete status = Failed file publishing every day.

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.