HighDots Forums  

I need to pass a session variable to a form in ASPinstead of the formfield itself ?

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss I need to pass a session variable to a form in ASPinstead of the formfield itself ? in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ian Currie
 
Posts: n/a

Default I need to pass a session variable to a form in ASPinstead of the formfield itself ? - 11-03-2005 , 08:55 PM






I need to pass a session variable to a form in ASP instead of the formfield
itself ?

This is so I can store the entire path and filename I am uploading as I use it
many times in several forms on the same page.

The asp page code bit I have changed and doesn't work is:-

<INPUT TYPE="FILE" NAME="<%= Session("file") %>" size="80">

Any ideas please anyone ?


Reply With Quote
  #2  
Old   
Baxter
 
Posts: n/a

Default Re: I need to pass a session variable to a form in ASP instead of the formfield itself ? - 11-03-2005 , 09:34 PM






Hi!
Try some thing like this.
<input type="hidden" name="file" value="<%=session("file")%>">
Dave

"Ian Currie" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
I need to pass a session variable to a form in ASP instead of the
formfield
itself ?

This is so I can store the entire path and filename I am uploading as I
use it
many times in several forms on the same page.

The asp page code bit I have changed and doesn't work is:-

INPUT TYPE="FILE" NAME="<%= Session("file") %>" size="80"

Any ideas please anyone ?




Reply With Quote
  #3  
Old   
Ian Currie
 
Posts: n/a

Default Re: I need to pass a session variable to a form in ASPinstead of the formfield itself ? - 11-04-2005 , 03:14 AM



Hi

Thankyou very much for this - I'll try it out...

Reply With Quote
  #4  
Old   
Ian Currie
 
Posts: n/a

Default Re: I need to pass a session variable to a form in ASPinstead of the formfield itself ? - 11-04-2005 , 03:28 AM



Hi

Now I'm getting this when I run it:-

'File saved successfully on the server as:
Object required'

The response page (part of code only) is:-

========================
<%
Dim oFileUp
dim pathname
dim FileSizeInBytes
FileSizeInBytes = request.totalbytes

'--- Instantiate the FileUp object
Set oFileUp = Server.CreateObject("SoftArtisans.FileUp")
oFileUp.OverwriteFiles = False
pathname = "/PropertyImages/" &
cstr((GetCountryName.Fields.Item("CountryName").Va lue)) 'Get the right path to
save the image to bfore saving...
'pathname = "/PropertyImages/" & cstr(oFileUp.form("CountryForImage")) 'Get
the right path to save the image to bfore saving...
'--- Set the Path property to the location you wish to temporarily cache the
incoming file before saving
oFileUp.Path = Server.MapPath(pathname)
'--- Check if a file was selected (myFile is coming from the html code)
'--- If so, continue processing
If Not oFileUp.Form("myFile").IsEmpty Then

If FileSizeInBytes <= 105582 Then 'File must not be larger than 100 Kb.
'response.write upload.form("CountryForImage")
'--- Save the file
oFileUp.Form("myFile").Save
'--- The file is saved, display a confirmation message
Response.Write ("<B>File saved successfully on the server as:</B><BR>")

'--- The ServerName() property is the full path of the file where it was
saved on the server
Response.Write(oFileUp.Form("myFile").ServerName)
Else
Response.Write("Error: File was larger than 100 Kb...")
End if
Else
Response.Write("Error: There was no file submitted for upload.")
End If
================
Any other resons why it won't go - the type of the file is BinaryREAD -
MULTIPART... ?


Reply With Quote
  #5  
Old   
Baxter
 
Posts: n/a

Default Re: I need to pass a session variable to a form in ASP instead of the formfield itself ? - 11-04-2005 , 06:15 AM



Hi!
The directory on the web server must have Read, Write, and Delete
permissions.
Have you checked this?

'--- Set the Path property to the location you wish to temporarily cache
the
incoming file before saving
oFileUp.Path = Server.MapPath(pathname) Don't you have to put the correct
path in here?
some thing like this Path = Server.Mappath ("/upload/folder name")

Dave




"Ian Currie" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
Hi

Now I'm getting this when I run it:-

'File saved successfully on the server as:
Object required'

The response page (part of code only) is:-

========================
%
Dim oFileUp
dim pathname
dim FileSizeInBytes
FileSizeInBytes = request.totalbytes

'--- Instantiate the FileUp object
Set oFileUp = Server.CreateObject("SoftArtisans.FileUp")
oFileUp.OverwriteFiles = False
pathname = "/PropertyImages/" &
cstr((GetCountryName.Fields.Item("CountryName").Va lue)) 'Get the right
path to
save the image to bfore saving...
'pathname = "/PropertyImages/" & cstr(oFileUp.form("CountryForImage"))
'Get
the right path to save the image to bfore saving...
'--- Set the Path property to the location you wish to temporarily cache
the
incoming file before saving
oFileUp.Path = Server.MapPath(pathname)
'--- Check if a file was selected (myFile is coming from the html code)
'--- If so, continue processing
If Not oFileUp.Form("myFile").IsEmpty Then

If FileSizeInBytes <= 105582 Then 'File must not be larger than 100 Kb.
'response.write upload.form("CountryForImage")
'--- Save the file
oFileUp.Form("myFile").Save
'--- The file is saved, display a confirmation message
Response.Write ("<B>File saved successfully on the server as:</B><BR>")

'--- The ServerName() property is the full path of the file where it was
saved on the server
Response.Write(oFileUp.Form("myFile").ServerName)
Else
Response.Write("Error: File was larger than 100 Kb...")
End if
Else
Response.Write("Error: There was no file submitted for upload.")
End If
================
Any other resons why it won't go - the type of the file is BinaryREAD -
MULTIPART... ?




Reply With Quote
  #6  
Old   
Ian Currie
 
Posts: n/a

Default Re: I need to pass a session variable to a form in ASPinstead of the formfield itself ? - 11-04-2005 , 06:38 AM



Hi

Yes, full rights on here. Also, it works if I put the filename object back in
the form instead of the hidden field and browse to select the file to upload -
the response is successful and the image uploads?


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.