Portal Home > Knowledgebase > Articles Database > Refreshing problem
Refreshing problem
Posted by stuffradio, 08-24-2007, 08:42 PM |
Just want to make sure that you closed your form, as you don't show it there :p
Also I think an easy way to fix this would be to just use the file_exists function.
|
Posted by brandrocker, 08-24-2007, 08:43 PM |
It appears that you have two options.
Either to run a separate script for saving the uploaded image, or, to use a session variable as a flag to control script execution.
Hope this helps.
|
Posted by brandrocker, 08-24-2007, 08:45 PM |
But you must know the image file name in advance.
|
Posted by stuffradio, 08-24-2007, 08:51 PM |
That's what the submitting form is for. As soon as the form is submitted all this is posted. Let me clarify:
|
Posted by b3nz, 08-25-2007, 01:54 AM |
Thanks
I've already closed the form after giving the requested values in html part. would you tell me where exactly I have to close it pls ?
and also, the picture will be saved with a randomly name. for example everytime you send an image it'll be saved with a different name
so if 2 users send 2 different pictures with the same name (for example untitled-1.bmp) both of them will be accepted
Thanks
for example we have a page like upload.html and then it sends the data to upload.php ? I've already done this but it didn't help me any much
and the second option you said was about making a session variable, I really didn't understand what exactly you mentioned but I think that using session variables could make a lot of problem when user wants to upload a different picture after that
anyway, would you tell me more about the details ?
|
Posted by Jatinder, 08-25-2007, 02:07 AM |
Separate the form and form handler into two separate scripts.
form.php => Form
form_exec.php => Form Handler
at the top of form.php add this code:
Then add a hidden field anywhere in your form:
In form_exec.php use the following code:
|
Posted by foobic, 08-25-2007, 06:03 AM |
Would it not be easier just to redirect after a successful upload, say to a page called uploaded.html? Then a refresh will do nothing. For people wanting to upload another image include a link back to the first page.
|
Posted by b3nz, 08-28-2007, 02:57 AM |
yes, nice and useful idea
Thank you, the problem solved
|
Add to Favourites Print this Article
Also Read