473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

refresh

hi all,

Is there a way to prevent a refresh of a page?
When a user refreshen on a certain page, pictures he already uploaded, will
upload again...

regards
Stijn
Jul 17 '05 #1
4 3828
Stijn Goris wrote:
hi all,

Is there a way to prevent a refresh of a page?
When a user refreshen on a certain page, pictures he already uploaded, will
upload again...

regards
Stijn

Do you mean downloaded or uploaded? Downloading is usually handled by
the browser cache settings and images aren't actually downloaded a
second time.
Jul 17 '05 #2
Stijn Goris wrote:

Is there a way to prevent a refresh of a page?
When a user refreshen on a certain page, pictures he already uploaded, will
upload again...


You could do something like this in your form:

<input type="hidden" name="uniqueid" value="<?PHP echo uniqid(); ?>">

And in your handling code, put something like this:

$file = file("logfile.txt");

//if form has been sent, make the user obtain a new unique id
if (in_array($_POST['uniqueid'], $file)):
echo 'The form has already been sent. Click <a href="foo.php">here</a> to
send again.';

else:
//Process your file uploads as you do now.

//write unique id to logfile
if ($logfile = fopen("logfile.txt", "a")) {
fwrite($logfile, $_POST['uniqueid']);
fclose($logfile);
}

endif;

You'd have to periodically clean out the logfile. You could also use a database
table to do this.

Regards,
Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #3

Shawn Wilson wrote:

Stijn Goris wrote:

Is there a way to prevent a refresh of a page?
When a user refreshen on a certain page, pictures he already uploaded, will
upload again...


You could do something like this in your form:

<input type="hidden" name="uniqueid" value="<?PHP echo uniqid(); ?>">

And in your handling code, put something like this:

$file = file("logfile.txt");

//if form has been sent, make the user obtain a new unique id
if (in_array($_POST['uniqueid'], $file)):
echo 'The form has already been sent. Click <a href="foo.php">here</a> to
send again.';

else:
//Process your file uploads as you do now.

//write unique id to logfile
if ($logfile = fopen("logfile.txt", "a")) {
fwrite($logfile, $_POST['uniqueid']);
fclose($logfile);
}

endif;

You'd have to periodically clean out the logfile. You could also use a database
table to do this.


Or, if you prefer an example that has a chance of working, try this line
instead:

fwrite($logfile, $_POST['uniqueid']."\n");

Regards,
Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #4
http://www.gzentools.com -- free online php tools
"Stijn Goris" <me*****@hotmail.com> wrote in message
news:bd********************@phobos.telenet-ops.be...
hi all,

Is there a way to prevent a refresh of a page?
When a user refreshen on a certain page, pictures he already uploaded, will upload again...

regards
Stijn


I take it at the moment you have 2 parts, 1-an upload form, 2-upload
script/page, change this to 3 parts,
1-upload form, 2-upload script, 3-page.
At the end of you upload script, redirtect to the destination page with this

<?php
// code to handle file upload

header("Location: http://www.yourdomain.com/nextpage.php");
?>

then if they refresh next page, it will not upload again.

--
Mike Bradley

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Scott | last post by:
I have a clickable graph that resides on page 1. If user clicks a data point on the graph, the page runs again yeilding a 2nd graph that shows a more detailed graph. Problem is, I have a...
4
by: Yogi_Bear_79 | last post by:
Self Taught here so please bear with me. I have the labelRestrictSites as private on the MainForm.cs. I then access the labelRestrictSites.Text thru the public string LabelRestrictSites from...
1
by: Marco Maroni | last post by:
How to force image refresh on client browser ? Is ti possible to force the refresh of the same image (tha was changed server-side) to the client, without user press Contrl+F5 in IE ? - Marco
9
by: PK9 | last post by:
I'm having an issue with the "Refresh" of an asp.net page. The refresh is actually calling my last onClick event. I thought that asp.net was supposed to be stateless in that it shouldn't...
0
by: Brad White | last post by:
Overview: I have a custom web app that has an 'Inbox' that refreshes every 30 seconds. One user uses Outlook to host the web page. Using IE, the refresh works fine. If the user is working in...
7
by: Brian | last post by:
hello, I am looking for a way to auto refresh a web page that I created, but also let the user choose to stop the auto refresh. I can not figure out how to stop the auto refresh. Any help would...
12
by: martin1 | last post by:
All, is there window form refresh property? I try to set up window form refresh per minute. Thanks
10
by: Bill Nguyen | last post by:
I would like to be able to get an active browser window to refresh the URL (reload) every 5 minutes. Is it possible in VB.NET? Thanks Bill
0
by: chetu | last post by:
I have two pivot tables, but when my macro refreshes the pivot tables it refreshes all, but I want it to pick say for example; Say range "B8" of pivot table 1 is 60, I want the range "x2" of pivot...
4
by: Simon | last post by:
Dear reader, If I change the content of a field in an event procedure and in the same procedure I do a refresh, the refresh has no effect. The code in the event is as follows:
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.