473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 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
  5.  
  6.  
  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")
  14.  
  15.         End Sub
  16.  
  17.         ' Destroy objects
  18.         Private Sub Class_Terminate()
  19.             'Set ObjFso = Nothing
  20.             Set aspUpload = Nothing
  21.         End Sub
  22.  
  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
  29.  
  30.             on error resume next                                
  31.  
  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"))
  40.  
  41.             aspUpload.OverwriteFiles = blnoverwrite 
  42.             aspUpload.SetMaxSize maxfilesize, True
  43.  
  44.             aspUpload.Save
  45.             'File.SaveAs path & "\" & File.FileName
  46.             Set File = aspUpload.Files("image_url0")
  47.  
  48.  
  49.             Set ObjFSO = server.CreateObject ("Scripting.FileSystemObject")            
  50.  
  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
  61.  
  62.  
  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 3127

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

Similar topics

2
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 same, which is to return the value of the field?? ...
2
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 this website. I have it working just fine. I'm...
3
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 document. In order to identify them, I read their...
11
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 can't have an input inside a form. Would some kind...
2
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 switch? E.g, if I run the form normally I get the...
2
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
9
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 really sure why, this happens for all of my controls...
6
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 textboxes in the header for entering different search...
3
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, instantiated it? I wanted to so something like this ......
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.