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
- Class pluginFileTransfer
- Public path, blnoverwrite, maxfilesize, SelectImageWidth
- Public uploadedFileName, uploadedFileSize, uploadedFilePath, uploaded_error
- Public contentType
- ' Create objects required by the plugin
- ' The 3rd party component etc.
- Private Sub Class_Initialize()
- 'ObjFso is already available so the following line is commented out
- 'Set ObjFSO = server.CreateObject ("Scripting.FileSystemObject")
- Set aspUpload = Server.CreateObject("Persits.Upload")
- aspUpload.ProgressID = Request.QueryString("PID")
- End Sub
- ' Destroy objects
- Private Sub Class_Terminate()
- 'Set ObjFso = Nothing
- Set aspUpload = Nothing
- End Sub
- ' Upload the posted file
- ' Return values: 0 - success, 1 - no file sent, 2 - path not found, 3 - write error, 4 - extension not allowed
- ' The public variable path (save location) should be set prior to calling this function.
- ' The public variables uploadedFileName, uploadedFileSize and contentType should be set before exiting this function.
- Public Function Upload()
- Dim file
- on error resume next
- If AspUpload.Form("select_filewidth") = "2" Then
- SelectImageWidth = 2
- Elseif AspUpload.Form("select_filewidth") = "1" Then
- SelectImageWidth = 1
- Else
- SelectImageWidth = 0
- End If
- SelectImageWidth = cstr(AspUpload.Form("select_filewidth"))
- aspUpload.OverwriteFiles = blnoverwrite
- aspUpload.SetMaxSize maxfilesize, True
- aspUpload.Save
- 'File.SaveAs path & "\" & File.FileName
- Set File = aspUpload.Files("image_url0")
- Set ObjFSO = server.CreateObject ("Scripting.FileSystemObject")
- If file is nothing Then
- Upload = 1
- ElseIf not ObjFso.FolderExists(Server.MapPath(path)) Then
- Upload = 2
- Else
- uploadedFileName = file.ExtractFileName
- 'Code where the file is uploaded
- End If
- Set ObjFso = Nothing
- End Function
- ' --- Internal variables and functions specific to this plugin only (non standard) ---
- ' Here, the private variables, functions specific to this plugin can be defined.
- Private aspUpload
- End Class