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 redirectResponse.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 LoginCall objPMod.StoreParameter ( "rfile", "Bom_Home.asp" )'------------ ACCESS CONTROL ------------------%><!--#include file="_access_control_general.asp"--><%'------------ Variable Definition -------------Dim objUploadDim sFileNameDim sPathDim newIDDim 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 toIf instr(Request.ServerVariables("HTTP_USER_AGENT"), "MSIE") > 0 ThensFileName = objUpload.Fields("results_file").FileNameElsesFileName = objUpload.Fields("results_file").FilePathEnd IfIf sFileName <> "" ThensPath = rootPath &"\pdf\"& sFileNameEnd If' Delete the file if already existsCall DeleteFile( sPath )' Save the binary data to the file systemobjUpload("results_file").SaveAs sPath' Put the file path into the databaseOraSession.BeginTransOraDatabase.ExecuteSQL "UPDATE BOMS SET PDF_ATTACHMENT_PATH='"& sFileName &"' WHERE BOM_ID ="& objUpload.Fields("bom_id").ValueOraSession.CommitTransIf Err.number <> 0 ThenCall RaiseMsgInParent ( enum_MSG_ERROR, "Upload is not completed.<br>"& Err.description )ElseCall OpenInParentWindow ("Bom_Home.asp?bom_id="& objUpload.Fields("bom_id").Value)End IfSet objUpload = NothingCall CloseWindowElseResponse.write "Some mendatory parameters are missing!" & "<br>" 'TODOResponse.write QSTR_AllEnd If%><!-- DESTRUCTOR -------><!--#include file="common/globals_destructor.asp"-->