%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
' NEW Upload PDF
' --- PROCESS FORM ---
'=====================================================
%>
<%
Option explicit
' Good idea to set when using redirect
Response.Expires = 0 ' always load the page, dont store
%>
<%
' Set rfile parameter. This is a return page after Login
Call objPMod.StoreParameter ( "rfile", "Bom_Home.asp" )
'------------ ACCESS CONTROL ------------------
%>
<%
'------------ Variable Definition -------------
Dim objUpload
Dim sFileName
Dim sPath
Dim newID
Dim retErrCode
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
Set objUpload = New clsUpload
'parPv_id = objUpload.Fields("pv_id").Value
'----------------------------------------------
%>
<%
'----------------------- MAIN LINE ---------------------------
'--- Process submition ---
If (objUpload.Fields("bom_id").Value <> "") Then
' Compile path to save file to
If instr(Request.ServerVariables("HTTP_USER_AGENT"), "MSIE") > 0 Then
sFileName = objUpload.Fields("results_file").FileName
Else
sFileName = objUpload.Fields("results_file").FilePath
End If
If sFileName <> "" Then
sPath = rootPath &"\pdf\"& sFileName
End If
' Delete the file if already exists
Call DeleteFile( sPath )
' Save the binary data to the file system
objUpload("results_file").SaveAs sPath
' Put the file path into the database
OraSession.BeginTrans
OraDatabase.ExecuteSQL "UPDATE BOMS SET PDF_ATTACHMENT_PATH='"& sFileName &"' WHERE BOM_ID ="& objUpload.Fields("bom_id").Value
OraSession.CommitTrans
If Err.number <> 0 Then
Call RaiseMsgInParent ( enum_MSG_ERROR, "Upload is not completed.
"& Err.description )
Else
Call OpenInParentWindow ("Bom_Home.asp?bom_id="& objUpload.Fields("bom_id").Value)
End If
Set objUpload = Nothing
Call CloseWindow
Else
Response.write "Some mendatory parameters are missing!" & "
" 'TODO
Response.write QSTR_All
End If
%>