Subversion Repositories DevTools

Rev

Rev 29 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@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
%>

<!--#include file="common/config.asp"-->
<!--#include file="common/globals.asp"-->
<!--#include file="common/formating.asp"-->
<!--#include file="common/qstr.asp"-->
<!--#include file="common/common_subs.asp"-->
<!--#include file="common/common_dbedit.asp"-->
<!--#include file="upload/clsUpload.asp"-->
<%
' Set rfile parameter. This is a return page after Login
Call objPMod.StoreParameter ( "rfile", "Bom_Home.asp" )
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_general.asp"-->
<%
'------------ 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.<br>"& 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!" & "<br>" 'TODO
        Response.write QSTR_All 
        
End If
%>


<!-- DESTRUCTOR ------->
<!--#include file="common/globals_destructor.asp"-->