Skip to content
Advertisement

upload image by refreshing page of web site

i write php code that upload image from client to host and site and my problem is if i refresh the page ,the last file going to upload again and its going dupplicate and if refresh again this problem happen again

my code:

JavaScript

Advertisement

Answer

The problem is occurring because you stay on the page that is processing the POST request. What you need to do is to redirect to another page or the page where you are uploading from, and show the result of the upload there.

You can redirect by using the header function like this:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement