473,700 Members | 2,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AspUpload Uplod.form("") in a class

1 New Member
When the form is submitted as ENCTYPE="multip art/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 3147

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

Similar topics

2
17758
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?? Thanks, John
2
5221
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 running IIS on my home machine. My problem is that I need to upload this stuff to a webhosting place and register a domain and I'm not sure what to put as the smtp mail server value
3
2702
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 "name" property (which sources from "name" HTML attribue). The problem is, that if the form contains form control named "name", it overwrites the form name property. In fact, I'm quite surprised that it's so easy to spoil any of the form object...
11
4170
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 soul please tell me what I'm doing wrong?
2
1771
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 form's UI, but if I run it with /q (or whatever), it runs non-interactively (perhaps logging to the event log). I did try parsing the command line in Main(), but of course Main is static and it's not possible therefore to use some field or method...
2
5809
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
21482
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 that invoke are invoking a post back. I've never used this type of method before, but I need to get the name of the control doing the postback in the Form Load event, and cannot wait until the event of the target control that runs due to the...
6
2426
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 criteria. I have a subform for displaying the results, which is bound to Query4. SQL for Query4 (taken from sql view in query): SELECT tblRecipes.RecipeName, tblRecipes.FoodCategory, Sum(Query3.IngredCost) AS SumOfIngredCost, Query3.RecipeID FROM...
3
1907
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 ... MsgBox("called by " & Owner.Name) .... but that throws a null reference exception. Parent.Name and ParentForm.Name also throw null reference exceptions. Form1.Name works - but that's not very flexible.
0
8714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8641
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9203
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8958
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7797
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4650
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2379
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.