hi all,
i am having a php page where we can upload and download files.Those files which are uploaded will be displayed in a table on the same page,for that i need to refresh page.So i used

<meta http-equiv="refresh"  content="3">

but it is refreshing for every 3 seconds. That causes some problem for me because when the user want to upload a file he clicks on browse and select some file if this happens in 3 seconds that is ok,but if it takes more than that,even if he selects the file due to that refresh he cannot upload.so for that i need to refresh only some part of my page. I came to know that ajax can do that. so can any one...
Thanks in advance.

8 Years
Discussion Span
Last Post by sergb

Using jQuery javascript library:

// filename: files.php

$files = get_uploaded_files();
$i = 1;
foreach ($files as $f) {
    echo "$i) $f<br>";
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
function getfiles() {
    var url = "files.php?t=" + (new Date()).getTime(); //kill browser cache
    // send request and load results into element with id=filelist

jQuery(function() {
    // Call getfiles function every 3 seconds.
    setInterval(getfiles, 3000);
Here are the files (updated every 3 seconds):
<div id="filelist"></div>

Hope this helps.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.