Pure ASPupload - saving form input values to cookies, sessions.... Support
1. Do not set the redirect page in the Pre ASP Upload UI
2. Find this line:
' End Pure Upload
'------------------------------------------------------------------------------
3. Add this code below it:
<%
If (CStr(Request.QueryString("GP_upload")) <> "") Then
New_redirectPage = "redirect_page.asp" 'Set the new redirect page
'Set our session, cookie or other variables from the form submissions
'Remember to use UploadFormRequest("") not Request.Form("")
Session("myFile") = UploadFormRequest("myFile")
Response.Cookies("DownloadID") = UploadFormRequest("myFile")
Response.Cookies("DownloadID").Expires = Date + 2
myVariable = UploadFormRequest("myFile")
'These are used to check for correct values
'Remove or comment then out after checking!
'And the Response.End!
Response.Write "Form value: " & UploadFormRequest("myFile") & "<P>"
Response.Write "Session value: " & Session("myFile") & "<P>"
Response.Write "Cookie value: " & Request.Cookies("DownloadID") & "<P>"
Response.Write "Variable value: " & myVariable & "<P>"
Response.End
'Redirect the page if we have set the above variable
If New_redirectPage <> "" Then
Response.Redirect(New_redirectPage)
End If
End If
%>
Comments
Finally
Cannot pass session variable using Pure ASP Upload
I’ve read all the replies for this article and still cannot pass a Session variable from one page to another when applying the Pure File Upload
I am using Dreamweaver: 8.02, Pure ASP Upload 3, ASP VBScript
I understand that after you use the Pure ASP Upload you can't use the Request.Form collection. Therefore I am using the UploadFormRequest(..) instead.
The following code is placed on the upload page (per your instructions):
<%
If (CStr(Request.QueryString("GP_upload")) <> "") ThenNew_redirectPage = "newsletter_added.asp" 'Set the new redirect page
'Set our session, cookie or other variables from the form submissions
Session("sessNewsletterFrom") = UploadFormRequest("NewsletterFrom")
Session("sessNewsletterPrivacyType") = UploadFormRequest("NewsletterPrivacyType")
Session("sessNewsletterSubject") = UploadFormRequest("NewsletterSubject")
Session("sessNewsletterMessage") = UploadFormRequest("NewsletterMessage")
Session("sessNewsletterAttachment1") = UploadFormRequest("NewsletterAttachment1")
Session("sessNewsletterAttachment2") = UploadFormRequest("NewsletterAttachment2")
Session("sessNewsletterAttachment3") = UploadFormRequest("NewsletterAttachment3")
'Redirect the page if we have set the above variable
If New_redirectPage <> "" Then
Response.Redirect(New_redirectPage)
End If
End If
%>
The following code is placed on the redirect page (per your instructions):
<%
'These are used to check for correct values
'Remove or comment then out after checking!
Response.Write "NewsletterFrom: " & Session("NewsletterFrom") & "<P>"
Response.Write "NewsletterSubject: " & Session("NewsletterSubject") & "<P>"
Response.Write "NewsletterPrivacyType: " & Session("NewsletterPrivacyType") & "<P>"
Response.Write "NewsletterMessage: " & Session("NewsletterMessage") & "<P>"
Response.Write "NewsletterAttachment1: " & Session("NewsletterAttachment1") & "<P>"
Response.Write "NewsletterAttachment2: " & Session("NewsletterAttachment2") & "<P>"
Response.Write "NewsletterAttachment3: " & Session("NewsletterAttachment3") & "<P>"
Response.End
%>
Any help would be greatly appreciated
Thanks Bill
You must me logged in to write a comment.