Replies Back to Article

Redirect after upload and pass the filename

Problem with example code
September 19, 2002 by Ryan Galloway

UploadRequestForm("file") didn't work form

I used UploadFormRequest("file") instead and all was fine.

RE: Problem with example code
October 1, 2002 by George Petrov
Thanks - was a typo - fixed it now.
How to pass more than one variable?
June 29, 2003 by Kung Chuprapawan
If we want to pass the variables other than filename, what will the scripts look like? Can anybody give us example?
Passing all parameters...
June 7, 2004 by Mark Handford

How can I adjust the above code to pass all of the form parameters and not just the 'filename' parameter?


RE: How to pass more than one variable?
April 19, 2006 by Mark Williams

Hello,

After going round in circles myself trying to do the exact same thing, I have discovered the answer to your problem...

Basically, what I needed to do was upload a file defined on a web form and pass other form field information (in session variables) to another page where they would be emailed (or processed in some other way).

This is what you should do to achieve this...

1. In Dreamweaver, open your web page that contains your form and set your Pure ASP Upload behaviour in the normal way. Make sure you do NOT specify an "After Upload Go To page" - just leave it blank.

2. In Dreamweaver's code view add the following information just below the ProcessUpload call and the associated End If and %> code (this code has been automatically added by Pure ASP Upload near the top of the page, just above the <html> call)...

<%
'Write form data to session variables and redirect to another page
If (CStr(Request.QueryString("GP_upload")) <> "") Then
  Session("sessField1") = UploadFormRequest("Field1")
  Session("sessField2") = UploadFormRequest("Field2")
  Session("sessFilename1") = UploadFormRequest("Filename1")
  Response.Redirect "process_form_data.asp"
End If
%>

Where Field1, Field2 and Filename1 are field names on your form. You can have as many as you like and call them whatever you like, as you also can with the session variable names and redirect page.

The result of adding this code is that the defined session variables are populated by the associated form field data. This session data is stored for the entire browser session so you can use the content on other pages. In my example I email the session data in process_form_data.asp, but you can do whatever you like with it!

Pure ASP Upload is a great extension but the help and FAQs are difficult to understand and often assume too much - especially for Newbies! I hope this resolves the problems many people have encountered once and for all!

Cheers,

Mark.