Page 1 of 1
FILE UPLOAD TRHOUGH FORMS, how to delete POST files
Posted: Sat Oct 26, 2002 8:21 pm
by Eugene
I have a form through which users can upload file.
After the file has been handled by my php script, a page is displayed where it is indicated that the file has been received. I then use the BACK button in the browser, but get back to the page where it says that the file was submitted (I want to come back to page with the form!!!).
In fact, the form and the file handling is all done in one php file, that calls itself upon a POST event. There is check in the code:
Code: Select all
if (is_uploaded_file($_FILESї'imageFile']ї'tmp_name']))
and at the end I try to get rid of that file by doing:
Code: Select all
unset($_FILESї'imageFile']ї'tmp_name']);
It does not seem to work.
I also tried just doing
Can somebody help me???
Thanks
UPDATE, using REFRESH works
Posted: Sat Oct 26, 2002 8:24 pm
by Eugene
UPDATE
When I use the REFRESH button in the browser, after the file has been processed, the form is displayed correctly.
Using BACK still doesnt work.
I dont understand why it is acting like this.
Posted: Sat Oct 26, 2002 8:28 pm
by volka
Do you get an an message window with something like "outdated, needs refresh"? when you hit the back-button?
Posted: Sat Oct 26, 2002 8:31 pm
by Eugene
no, there is no message
is it possible that the BACK action actually re-submits the form??????
Posted: Sat Oct 26, 2002 8:52 pm
by volka
yes, but my browser asks me before doing that....
Posted: Sat Oct 26, 2002 8:54 pm
by Eugene
I read somewhere that at the end of a POST session (when the file specified in the ACTION option finishes running) the POST variables are suposed to be removed from the temporary directory of the web server.
Is that true?????
Can I somehow force delete the POSTED information and file??????
Posted: Sat Oct 26, 2002 9:00 pm
by volka
POST-data is sent from client to browser and not necessarily stored at the server. PHP stores POST/file-upload data in a temp. directory but not the post-vars. Unsetting them is useless since the browser will sent them again. Take a look at this board how it (tries to) prevents double posts using the back-button

Posted: Sat Oct 26, 2002 9:45 pm
by Eugene

Very true
I explored a bit how the client-server interaction:
Pressing the refresh button actually resubmits the form (there is a message that appears, asking if I want to resubmit)
Pressing back, the form re-appears with the fields filled in, but the information is not sudmitted. Somehow,
Code: Select all
is_uploaded_file($_FILESї'imageFile']ї'tmp_name'])
still return true however.
But I think I am worrying for nothing. I made my script such that after a file has been submitted, the form re-appears again, so people can submit other files. And if they want to leave that section I hope that they will use links and not press the back button
thank you very much
PS: I actually have another question, about MySQL this time. Is there a way of ordereing the entries in a database alphabetically (using names for example)???
Posted: Sat Oct 26, 2002 9:53 pm
by volka
try
Code: Select all
if(isset($_FILESї'imageFile']) && !empty($_FILESї'imageFile']ї'size'])
&& is_uploaded_file($_FILESї'imageFile']ї'tmp_name']) )
the order created by
ORDER BY for a string-field is alphabetically
http://www.mysql.com/documentation/mysq ... ote]Values in CHAR and VARCHAR columns are sorted and compared in case-insensitive fashion, unless the BINARY attribute was specified when the table was created. The BINARY attribute means that column values are sorted and compared in case-sensitive fashion according to the ASCII order of the machine where the MySQL server is running. BINARY doesn't affect how the column is stored or retrieved.
The BINARY attribute is sticky. This means that if a column marked BINARY is used in an expression, the whole expression is compared as a BINARY value.[/quote]