Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7739203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:27:48+00:00 2026-06-01T08:27:48+00:00

I’ve a php page with some forms used to upload images. Each form upload

  • 0

I’ve a php page with some forms used to upload images. Each form upload one image. Uploaded images replace images yet loaded in the page.

Here is a snippet:

<?php
// NO CACHING CODE
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

// FORM SUBMIT CODE
if (isset($_POST['submit_img1'])) {
    // used for some photo manipulation and checks
    require_once('WideImage/WideImage.php');
    //... some code ...
    unlink("path/" . $img1);
    $img_name = "path/" . $img1;
    $wideImage->saveToFile($img_name, 80);
    // ... some code ...
}

// PRINT IMAGE IN THE PAGE
echo '<p><img src="path/' . $img1 . '" width="100" height="100" class="prof_img" /></p>';
?> 

  //FORM FOR CHANGE THE IMAGE
    <form id="form_img1" name="form_img1" method="post" onSubmit="return checkFormImg1()"
action="" enctype="multipart/form-data">
    <input class="prof_input" type="file" name="img1" id="img1" />
    <input name="submit_img1" type="submit" class="prof_submit" value="Inserisci Immagine 1"
    />
</form>

The problem is that on reload (after submit button is pressed) the old images are displayed. But the new images have been properly uploaded replacing the old ones.

Excuse my english.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:27:50+00:00Added an answer on June 1, 2026 at 8:27 am

    theres an easy little trick you can use for this. just append a random string to the end of the image file source like a $_GET parameter.

    better than a random string is a timestamp, since your won’t risk using the same number twice.

    use it like this in your img tag

    src='img.jpg?rand=1234'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm making a simple page using Google Maps API 3. My first. One marker
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.