Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
29 jtweddle 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
' 			 	   NEW Upload	PDF
5
'               --- PROCESS FORM ---
6
'=====================================================
7
%>
8
<%
9
Option explicit
10
' Good idea to set when using redirect
11
Response.Expires = 0	' always load the page, dont store
12
%>
13
 
14
<!--#include file="common/config.asp"-->
15
<!--#include file="common/globals.asp"-->
16
<!--#include file="common/formating.asp"-->
17
<!--#include file="common/qstr.asp"-->
18
<!--#include file="common/common_subs.asp"-->
19
<!--#include file="common/common_dbedit.asp"-->
20
<!--#include file="upload/clsUpload.asp"-->
21
<%
22
' Set rfile parameter. This is a return page after Login
23
Call objPMod.StoreParameter ( "rfile", "Bom_Home.asp" )
24
'------------ ACCESS CONTROL ------------------
25
%>
26
<!--#include file="_access_control_general.asp"-->
27
<%
28
'------------ Variable Definition -------------
29
Dim objUpload
30
Dim sFileName
31
Dim sPath
32
Dim newID
33
Dim retErrCode
34
'------------ Constants Declaration -----------
35
'------------ Variable Init -------------------
36
Set objUpload = New clsUpload
37
'parPv_id = objUpload.Fields("pv_id").Value
38
'----------------------------------------------
39
%>
40
<%
41
'-----------------------  MAIN LINE  ---------------------------
42
 
43
'--- Process submition ---
44
 
45
If (objUpload.Fields("bom_id").Value <> "") Then
46
 
47
	' Compile path to save file to
48
	If instr(Request.ServerVariables("HTTP_USER_AGENT"), "MSIE") > 0 Then
49
		sFileName = objUpload.Fields("results_file").FileName
50
	Else
51
		sFileName = objUpload.Fields("results_file").FilePath
52
	End If
53
 
54
	If sFileName <> "" Then
55
		sPath = rootPath &"\pdf\"& sFileName
56
	End If
57
 
58
	' Delete the file if already exists
59
	Call DeleteFile( sPath )
60
 
61
	' Save the binary data to the file system
62
	objUpload("results_file").SaveAs sPath
63
 
64
	' Put the file path into the database
65
	OraSession.BeginTrans
66
	OraDatabase.ExecuteSQL "UPDATE BOMS SET PDF_ATTACHMENT_PATH='"& sFileName &"' WHERE BOM_ID ="& objUpload.Fields("bom_id").Value
67
	OraSession.CommitTrans
68
 
69
 
70
	If Err.number <> 0 Then
71
		Call RaiseMsgInParent ( enum_MSG_ERROR, "Upload is not completed.<br>"& Err.description )
72
	Else
73
		Call OpenInParentWindow ("Bom_Home.asp?bom_id="& objUpload.Fields("bom_id").Value)
74
	End If
75
 
76
	Set objUpload = Nothing
77
	Call CloseWindow
78
 
79
Else
80
	Response.write "Some mendatory parameters are missing!" & "<br>" 'TODO
81
	Response.write QSTR_All 
82
 
83
End If
84
%>
85
 
86
 
87
<!-- DESTRUCTOR ------->
88
<!--#include file="common/globals_destructor.asp"-->
89