472,337 Members | 1,488 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,337 software developers and data experts.

AspUpload Uplod.form("") in a class

When the form is submitted as ENCTYPE="multipart/form-data" using AspUpload component, I understand to use Upload.form("") to retreive the form elements. But I cannot retreive it from inside a class.

Anybody can help?

The form page goes to upload.asp, where inside upload.asp it calls the class which reads the form element and return back the values.

Here is the code of the class.

Expand|Select|Wrap|Line Numbers
  1. Class pluginFileTransfer
  2.         Public path, blnoverwrite, maxfilesize, SelectImageWidth
  3.         Public uploadedFileName, uploadedFileSize, uploadedFilePath, uploaded_error
  4.         Public contentType
  7.         ' Create objects required by the plugin
  8.         ' The 3rd party component etc.
  9.         Private Sub Class_Initialize()
  10.             'ObjFso is already available so the following line is commented out
  11.             'Set ObjFSO = server.CreateObject ("Scripting.FileSystemObject")
  12.             Set aspUpload = Server.CreateObject("Persits.Upload")    
  13.             aspUpload.ProgressID = Request.QueryString("PID")
  15.         End Sub
  17.         ' Destroy objects
  18.         Private Sub Class_Terminate()
  19.             'Set ObjFso = Nothing
  20.             Set aspUpload = Nothing
  21.         End Sub
  23.         ' Upload the posted file
  24.         ' Return values: 0 - success, 1 - no file sent, 2 - path not found, 3 - write error, 4 - extension not allowed
  25.         ' The public variable path (save location) should be set prior to calling this function.
  26.         ' The public variables uploadedFileName, uploadedFileSize and contentType should be set before exiting this function.
  27.         Public Function Upload()
  28.             Dim file
  30.             on error resume next                                
  32.             If AspUpload.Form("select_filewidth") = "2" Then
  33.                 SelectImageWidth = 2
  34.             Elseif AspUpload.Form("select_filewidth") = "1" Then
  35.                 SelectImageWidth = 1
  36.             Else
  37.                 SelectImageWidth = 0
  38.             End If
  39.             SelectImageWidth = cstr(AspUpload.Form("select_filewidth"))
  41.             aspUpload.OverwriteFiles = blnoverwrite 
  42.             aspUpload.SetMaxSize maxfilesize, True
  44.             aspUpload.Save
  45.             'File.SaveAs path & "\" & File.FileName
  46.             Set File = aspUpload.Files("image_url0")
  49.             Set ObjFSO = server.CreateObject ("Scripting.FileSystemObject")            
  51.             If file is nothing Then
  52.                 Upload = 1
  53.             ElseIf not ObjFso.FolderExists(Server.MapPath(path)) Then 
  54.                 Upload = 2
  55.             Else
  56.                 uploadedFileName = file.ExtractFileName                
  57.                 'Code where the file is uploaded
  58.             End If
  59.             Set ObjFso = Nothing
  60.         End Function
  63.          ' --- Internal variables and functions specific to this plugin only (non standard) ---
  64.         ' Here, the private variables, functions  specific to this plugin can be defined.
  65.         Private aspUpload
  66.     End Class        
May 7 '06 #1
0 3055

Sign in to post your reply or Sign up for a free account.

Similar topics

by: John Davis | last post by:
I want to know what's the differences between Request.Form("Field Name") and Request.QueryString("Field Name") OR they function exactly the...
by: Mindful_Spirit | last post by:
I'm trying to set up a basic email feed back form like this, and was wondering about some basic configuration settings. I have used code from...
by: Pavils Jurjans | last post by:
Hello, I have bumped upon this problem: I do some client-side form processing with JavaScript, and for this I loop over all the forms in the...
by: Pete Wilson | last post by:
Hi folks -- The page at http://www.pwilson.net/submit-demo.html will not validate. The validator at http://validator.w3.org tells me I...
by: Mark | last post by:
Hi all, Is there a "standard" way to structure a small windows form such that it can run non-interactively with an appropriate command line...
by: Marty | last post by:
Hi, How do we make a form "stick" to another window (something like Winamp)? I'm using C# .NET 2003. Thank you very much. Marty
by: Dan | last post by:
I am trying to use Request.Form("__EVENTTARGET") to get the name of the control that caused a post back. It keeps returning "". I am not...
by: KiwiGenie | last post by:
Hi..I am trying to make a search form. I am fairly new to access and could well be looking at it completely wrong. I have an unbound form with...
by: eBob.com | last post by:
How does a "sub-form", i.e. one invoked by another form, determine anything about the form which brought it into existence, i.e., I suppose,...
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.