POST redirect to GET passing variable other than in the URL

loachlina

New Member
Is there a thread safe way of passing variables when redirecting a POST to a GET without passing the variables in the URL?What I'm trying to achieve is this. I have a page that contains a form that allows users to upload images. That form is sent by the browser to my server as a POST. If the image upload is successful, the page is redirected to a GET where I want to show the image that the user has just uploaded. The only safe way I can think of passing a variable between the two pages is via a GET parameter.ImageUpload.php\[code\]$imageID = processImageUpload();if($imageID){ redirect("/ImageDisplay.php?uploadedImageID=".$imageID)}\[/code\]ImageDisplay.php\[code\]$uploadedImageID = getRequestVariable('uploadedImageID');if($uploadedImageID != FALSE){ //Display the image just uploaded with an 'image uploaded success!' message}//Display all the other images\[/code\]Although it's not the worst thing in the world, having the variable included as a GET param is a bit ugly. It's also slightly misleading as if the user hits refresh on the redirected page the will see the 'image uploaded success!' message again, even though they haven't just uploaded an image.Is there another way that is thread safe of passing variables from the POST page to the GET page?Using session or cookies variables aren't safe as there could be two images uploaded at once and so there could be race conditions.I thought I could use an redirect and then read the referrer header e.g.:[*]POST to ImageUpload.php which redirects to[*]GET ImageDisplay.php&uploadedImageID=123 which redirects to [*]GET ImageDisplay.php where I would read the referrer from the previousGET request.However it seems that the referrer is always the page that held the upload form, not any if the intermediate steps.Is there any other way of passing a variable from one request to another, other than as a GET parameter?
 
Back
Top