vsshah
asked on
How to Upload .jpg file (stored at server Hard Disk) to Database using ASP.
Hi,
With the help of https://www.experts-exchange.com, I am able to do following.
1. Select file(through browser) at client machine, and upload that .jpg file in to SQL Server database.
2. Select file(through browser) at client machine, and upload it Server Hard disk.
3. Get image from database, and display it to .ASP page report.
4. I did all above and following things in Visual Basic/VBA/Ms Access also. but ASP is something new.
My question is as below.
I am using ASP+VBScript. My Company's one Department user(client machine) wants to select any .BMP file thru Browser from their own machine and want to save it to SQL Server Database. SQL Server database is located at Server Hard Disk. I have divided this issue in 5 steps.
1. Open browser and select .BMP file from user's client machine. I mean, User will select the file from Browser and hit UPLoad button.
2. Copy This .BMP file to Server Hard Disk.
3. Convert .BMP file to .JPG at Server Hard Disk and store it.
4. Upload this .JPG file to SQL Server Database
5. Delete temporary created .JPG, .BMP file from Server Hard Disk.
I am able to all above except Step# 4. how to do it ??
I have gone through http://www.stardeveloper.com/articles/display.html?article=2001033101&page=1
Thanks,
With the help of https://www.experts-exchange.com, I am able to do following.
1. Select file(through browser) at client machine, and upload that .jpg file in to SQL Server database.
2. Select file(through browser) at client machine, and upload it Server Hard disk.
3. Get image from database, and display it to .ASP page report.
4. I did all above and following things in Visual Basic/VBA/Ms Access also. but ASP is something new.
My question is as below.
I am using ASP+VBScript. My Company's one Department user(client machine) wants to select any .BMP file thru Browser from their own machine and want to save it to SQL Server Database. SQL Server database is located at Server Hard Disk. I have divided this issue in 5 steps.
1. Open browser and select .BMP file from user's client machine. I mean, User will select the file from Browser and hit UPLoad button.
2. Copy This .BMP file to Server Hard Disk.
3. Convert .BMP file to .JPG at Server Hard Disk and store it.
4. Upload this .JPG file to SQL Server Database
5. Delete temporary created .JPG, .BMP file from Server Hard Disk.
I am able to all above except Step# 4. how to do it ??
I have gone through http://www.stardeveloper.com/articles/display.html?article=2001033101&page=1
Thanks,
ASKER
thanks for reply.
My field type in table in IMAGE. I need step 2 and 3. Because, I dont want to Upload .BMP file in to database. It is too big. So, I have to convert it in to .jpg.
Code for 'Select file(through browser) at client machine, and upload that .jpg file in to SQL Server database' is as below. It takes file from browser and then upload it to database. While I want to pick up file from Server hard disk and upload it to database.
----
insert.asp
<!--#include file="Loader.asp"-->
<%
Response.Buffer = True
' load object
Dim load
Set load = new Loader
' calling initialize method
load.initialize
' File binary data
Dim fileData
fileData = load.getFileData("file")
' File name
Dim fileName
fileName = LCase(load.getFileName("fi le"))
' File path
Dim filePath
filePath = load.getFilePath("file")
' File path complete
Dim filePathComplete
filePathComplete = load.getFilePathComplete(" file")
' File size
Dim fileSize
fileSize = load.getFileSize("file")
' File size translated
Dim fileSizeTranslated
fileSizeTranslated = load.getFileSizeTranslated ("file")
' Content Type
Dim contentType
contentType = load.getContentType("file" )
' No. of Form elements
Dim countElements
countElements = load.Count
' Value of text input field "fname"
Dim fnameInput
fnameInput = load.getValue("fname")
' Value of text input field "lname"
Dim lnameInput
lnameInput = load.getValue("lname")
' Value of text input field "profession"
Dim profession
profession = load.getValue("profession" )
' destroying load object
Set load = Nothing
%>
<html>
<head>
<title>Inserts Images into Database</title>
<style>
body, input, td { font-family:verdana,arial; font-size:10pt; }
</style>
</head>
<body>
<p align="center">
<b>Inserting Binary Data into Database</b><br>
<a href="show.asp">To see inserted data click here</a>
</p>
<%
CartName = Request.QueryString("CartN ame")
CustId = Request.QueryString("CustI d")
CustPlant = Request.QueryString("CustP lant")
%>
<table width="700" border="1" align="center">
<tr>
<td>File Name</td><td><%= fileName %></td>
</tr><tr>
<td>File Path</td><td><%= filePath %></td>
</tr><tr>
<td>File Path Complete</td><td><%= filePathComplete %></td>
</tr><tr>
<td>File Size</td><td><%= fileSize %></td>
</tr><tr>
<td>File Size Translated</td><td><%= fileSizeTranslated %></td>
</tr><tr>
<td>Content Type</td><td><%= contentType %></td>
</tr><tr>
<td>No. of Form Elements</td><td><%= countElements %></td>
</tr>
</table><br><br>
<p style="padding-left:220;">
<%= fileName %> data received ...<br>
<%
' Checking to make sure if file was uploaded
If fileSize > 0 Then
' Connection string
Dim connStr
set connStr = Server.CreateObject("ADODB .Connectio n")
connStr.open = "dsn=Test_UGN_DB_DSN;uid=s a;pwd=arih ant;"
' Recordset object
Dim rs
Set rs = Server.CreateObject("ADODB .Recordset ")
sqltext = "select cartname, contenttypepicture3, Picture3Size, Picture3 from Cart_M where CartName = '" & CartName & "' and Cart_M.CustId = " & CustId & " and Cart_M.CustPlant = '" & CustPlant & "'"
rs.Open sqltext, connStr, 2, 4
' Adding data
rs("Picture3Size") = fileSize
rs("Picture3").AppendChunk fileData
rs("contenttypepicture3") = contentType
rs.UpdateBatch
rs.Close
Set rs = Nothing
Response.Write "<font color=""green"">File was successfully uploaded...</font>"
Else
Response.Write "<font color=""brown"">No file was selected for uploading...</font>"
End If
If Err.number <> 0 Then
Response.Write "<br><font color=""red"">Something went wrong...</font>"
End If
response.redirect("Picture _Upload.as p?CartName =" & CartName & "&CustId=" & CustId & "&CustPlant=" & CustPlant )
%>
</p>
<br>
</body>
</html>
--------------------
Picture_Upload.asp
<%@LANGUAGE="VBSCRIPT"%>
<!-- #include file="UploadFile.asp" -->
<!-- #include file="../Connections/UGN_D B.asp" -->
<script language = "JavaScript">
function isDigit(theDigit)
{
var digitArray = new Array('0','1','2','3','4', '5','6','7 ','8','9') ,j;
for (j = 0; j < digitArray.length; j++)
{if (theDigit == digitArray[j])
return true
}
return false
}
/************************* ********** ********** ********** ********** ********/
/*Function name :isPositiveInteger(theStri ng) */
/*Usage of this function :test for an +ve integer */
/*Input parameter required:thedata=string for test whether is +ve integer*/
/*Return value :if is +ve integer,return true */
/* else return false */
/*function require :isDigit */
/************************* ********** ********** ********** ********** ********/
function isPositiveInteger(theStrin g)
{
var theData = new String(theString)
if (!isDigit(theData.charAt(0 )))
if (!(theData.charAt(0)== '+'))
return false
for (var i = 1; i < theData.length; i++)
if (!isDigit(theData.charAt(i )))
return false
return true
}
/************************* ********** ********** ********** ********** *****/
/*Function name :isDate(s,f) */
/*Usage of this function :To check s is a valid format */
/*Input parameter required:s=input string */
/* f=input string format */
/* =1,in mm/dd/yyyy format */
/* else in dd/mm/yyyy */
/*Return value :if is a valid date return 1 */
/* else return 0 */
/*Function required :isPositiveInteger() */
/************************* ********** ********** ********** ********** *****/
function isDate(s,f)
{
var a1=s.split("/");
var a2=s.split("-");
var e=true;
if ((a1.length!=3) && (a2.length!=3))
{
e=false;
}
else
{if (a1.length==3)
var na=a1;
if (a2.length==3)
var na=a2;
if (isPositiveInteger(na[0]) && isPositiveInteger(na[1]) && isPositiveInteger(na[2]))
{ if (f==1)
{var d=na[1],m=na[0];
}
else
{var d=na[0],m=na[1];
}
var y=na[2];
if (((e) && (y<1000)||y.length>4))
e=false
if (e)
{
v=new Date(m+"/"+d+"/"+y);
if (v.getMonth()!=m-1)
e=false;
}
}
else
{
e=false;
}
}
return e
}
function CheckDate(v)
{
var s=v.value;
if (!(s == ""))
{
if (!(isDate(s,1))) //dd/mm/yyyy format
{
alert("The inputed date value is not valid. Please Enter date in mm/dd/yyyy format");
document.form1.CartName.fo cus();
v.value = "";
v.focus();
return false;
}
}
}
function CheckGrossWeight(v)
{
var s=v.value;
if (isNaN(s))
{
alert("Please enter Gross Weight using numeric characters only! Your entered value '" + s + "' is not numeric.");
document.form1.CartName.fo cus();
v.value = "";
v.focus();
return false;
}
}
function CheckQtyPacked(v)
{
var s=v.value;
if (isNaN(s))
{
alert("Please enter Qty Packed using numeric characters only! Your entered value '" + s + "' is not numeric.");
//document.form2.qtypacked .focus();
v.value = "";
v.focus();
return false;
}
}
function deletebuttonclick(msg)
{
//confirm(msg);
var x=window.confirm(msg)
if (x)
{
location.href = "Cart_Delete.asp?" + document.form1.MM_QueryStr ing.value;
return true;
}
else
{
//alert("Not Agree");
}
}
function uploadbuttonclick(uploaded file)
{
alert("uploadedfile = " + uploadedfile.value );
newWindow = window.open();
newWindow.location.href = "Picture_Upload_Action.asp ?" + "<%=Request.QueryString%>" + "&uploadedfile=" + uploadedfile.value;
}
function previewbuttonclick()
{
newWindow = window.open();
newWindow.location.href = "rpt_packaging_layout.asp? CartName=" + document.form1.CartName.va lue + "&CustId=" + document.form1.CustId.valu e + "&CustPlant=" + document.form1.CustPlant.v alue;
}
function checkfiletype(thevalue)
{
var regx = new RegExp(".jpg$","i")
if (regx.test(thevalue))
{
//alert("Cool")
return true;
}
else
{
alert("Please Select only .jpg fles")
document.form2.Submit2.foc us;
document.form2.file.value = "";
thevalue.focus;
return false;
}
}
function filetypecheck()
{
var regx = new RegExp(".jpg$","i")
if (regx.test(document.form2. file.value ))
{
//alert("Cool")
return true;
}
else
{
alert("Please Select only .jpg fles")
return false;
}
}
function checkfields()
{
var num = document.form1.elements.le ngth
var localpcks002 = "<%=session("PCKS002")%>"; //NEW CONTAINER Entry
var ugnDeptNo = "<%=session("MM_UGNDeptNo" )%>"; // Dept # 6 - Packaging
var ugnUserId = "<%=session("MM_UserId")%> "; //EmpId of User
//alert("localpcks001 = " + localpcks001 + ", ugnDeptNo = " + ugnDeptNo + ", ugnUserId = " + ugnUserId );
for (var i=0; i<num;i++)
{
if ( localpcks002 == "E" ) //Packaging Dept user will have EDIT rights
{
document.form1.elements[i] .disabled = false;
}
else //// Select/ReadOnly. None of above condition satisfied then disable all fields.
{
document.form1.elements[i] .disabled = true;
}
}
} // end of function checkfields()
function checkfieldsform2()
{
var num = document.form2.elements.le ngth
var localpcks002 = "<%=session("PCKS002")%>"; //NEW CONTAINER Entry
var ugnDeptNo = "<%=session("MM_UGNDeptNo" )%>"; // Dept # 6 - Packaging
var ugnUserId = "<%=session("MM_UserId")%> "; //EmpId of User
//alert("localpcks001 = " + localpcks001 + ", ugnDeptNo = " + ugnDeptNo + ", ugnUserId = " + ugnUserId );
for (var i=0; i<num;i++)
{
if ( localpcks002 == "E" ) //Packaging Dept user will have EDIT rights
{
document.form2.elements[i] .disabled = false;
}
else //// Select/ReadOnly. None of above condition satisfied then disable all fields.
{
document.form2.elements[i] .disabled = true;
}
}
} // end of function checkfieldsform2()
</script>
<%
' *** Logout the current user.
MM_Logout = CStr(Request.ServerVariabl es("URL")) & "?MM_Logoutnow=1"
If (CStr(Request("MM_Logoutno w")) = "1") Then
Session.Contents.Remove("M M_Username ")
Session.Contents.Remove("M M_UserAuth orization" )
MM_logoutRedirectPage = "../ugndb_login.asp"
' redirect with URL parameters (remove the "MM_Logoutnow" query param).
if (MM_logoutRedirectPage = "") Then MM_logoutRedirectPage = CStr(Request.ServerVariabl es("URL"))
If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_newQS = "?"
For Each Item In Request.QueryString
If (Item <> "MM_Logoutnow") Then
If (Len(MM_newQS) > 1) Then MM_newQS = MM_newQS & "&"
MM_newQS = MM_newQS & Item & "=" & Server.URLencode(Request.Q ueryString (Item))
End If
Next
if (Len(MM_newQS) > 1) Then MM_logoutRedirectPage = MM_logoutRedirectPage & MM_newQS
End If
Response.Redirect(MM_logou tRedirectP age)
End If
%>
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariabl es("SCRIPT _NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request. QueryStrin g)
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables
If (CStr(Request("MM_update") ) = "form1" And CStr(Request("MM_recordId" )) <> "") Then
MM_editConnection = MM_UGN_DB_STRING
MM_editTable = "dbo.Cart_M"
MM_editColumn = "CartName"
MM_recordId = "'" + Request.Form("MM_recordId" ) + "'"
MM_editRedirectUrl = "Picture_Upload.asp"
MM_fieldsStr = "CartName|value|ContainerN o|value|Cu stId|value |CustPlant |value|mod elyear|val ue|Model|v alue|UGNFa cility|val ue|UGNDept No|value|R evisionDat e|value|Em pId|value| SingleMult iPartFlag| value|Gros sWeight|va lue|IsPubl ished|valu e"
MM_columnsStr = "CartName|',none,''|Contai nerNo|',no ne,''|Cust Id|none,no ne,NULL|Cu stPlant|', none,''|Mo delYear|no ne,none,NU LL|Model|' ,none,''|U GNFacility |none,none ,NULL|UGND eptNo|none ,none,NULL |RevisionD ate|',none ,NULL|EmpI d|none,non e,NULL|Sin gleMultiPa rtFlag|',n one,''|Gro ssWeight|n one,none,N ULL|IsPubl ished|none ,none,NULL "
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_field s(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Update Record: construct a sql update statement and execute it
If (CStr(Request("MM_update") ) <> "" And CStr(Request("MM_recordId" )) <> "") Then
' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1)," ,")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","'' ") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject("ADODB .Command")
MM_editCmd.ActiveConnectio n = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnectio n.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editR edirectUrl )
End If
End If
End If
%>
<%
Dim Cart_M__vCartName
Cart_M__vCartName = "%"
If (Request.QueryString("Cart Name") <> "") Then
Cart_M__vCartName = Request.QueryString("CartN ame")
End If
%>
<%
Dim Cart_M__vCustId
Cart_M__vCustId = "0"
If (Request.QueryString("Cust Id") <> "") Then
Cart_M__vCustId = Request.QueryString("CustI d")
End If
%>
<%
Dim Cart_M__VCustPlant
Cart_M__VCustPlant = "%"
If (Request.QueryString("Cust Plant") <> "") Then
Cart_M__VCustPlant = Request.QueryString("CustP lant")
End If
%>
<%
Dim Cart_M
Dim Cart_M_numRows
Set Cart_M = Server.CreateObject("ADODB .Recordset ")
Cart_M.ActiveConnection = MM_UGN_DB_STRING
Cart_M.Source = "SELECT CartName, ContainerNo, RevisionDate, CustId, CustPlant, Model, ModelYear, EmpId, GrossWeight, IsPublished, UGNFacility, UGNDeptNo, SingleMultiPartFlag FROM Cart_M WHERE Cart_M.CartName = '" + Replace(Cart_M__vCartName, "'", "''") + "' and Cart_M.CustId = '" + Replace(Cart_M__vCustId, "'", "''") + "' and Cart_M.CustPlant = '" + Replace(Cart_M__VCustPlant , "'", "''") + "' ORDER BY Cart_M.CartName"
'response.write("Cart_M.So urce = " & Cart_M.Source)
'response.end
Cart_M.CursorType = 0
Cart_M.CursorLocation = 2
Cart_M.LockType = 1
Cart_M.Open()
Cart_M_numRows = 0
%>
<%
Dim Cust_M
Dim Cust_M_numRows
Set Cust_M = Server.CreateObject("ADODB .Recordset ")
Cust_M.ActiveConnection = MM_UGN_DB_STRING
Cust_M.Source = "SELECT Cust_M.CustId, Cust_M.CustName FROM Cust_M ORDER BY CustName "
Cust_M.CursorType = 0
Cust_M.CursorLocation = 2
Cust_M.LockType = 1
Cust_M.Open()
Cust_M_numRows = 0
%>
<%
Dim Cust_Plant_M
Dim Cust_Plant_M_numRows
Set Cust_Plant_M = Server.CreateObject("ADODB .Recordset ")
Cust_Plant_M.ActiveConnect ion = MM_UGN_DB_STRING
Cust_Plant_M.Source = "SELECT Cust_Plant_M.CustPlant, Cust_M.CustName + '-> ' + Cust_Plant_M.CustPlant as CustPlantName FROM Cust_M, Cust_Plant_M Where Cust_M.CustId = Cust_Plant_M.CustId ORDER BY Cust_M.CustName, Cust_Plant_M.CustPlant "
Cust_Plant_M.CursorType = 0
Cust_Plant_M.CursorLocatio n = 2
Cust_Plant_M.LockType = 1
Cust_Plant_M.Open()
Cust_Plant_M_numRows = 0
%>
<%
Dim Employee_M
Dim Employee_M_numRows
Set Employee_M = Server.CreateObject("ADODB .Recordset ")
Employee_M.ActiveConnectio n = MM_UGN_DB_STRING
Employee_M.Source = "SELECT EmpId, EmplastName + ', ' + EmpFirstName AS EmpName FROM Employee_M WHERE EmpStatus='Working' ORDER BY EmplastName +' '+ EmpFirstName"
Employee_M.CursorType = 0
Employee_M.CursorLocation = 2
Employee_M.LockType = 1
Employee_M.Open()
Employee_M_numRows = 0
%>
<%
Dim Container_M
Dim Container_M_numRows
Set Container_M = Server.CreateObject("ADODB .Recordset ")
Container_M.ActiveConnecti on = MM_UGN_DB_STRING
Container_M.Source = "SELECT Container_M.ContainerNo FROM Container_M ORDER BY Container_M.ContainerNo"
Container_M.CursorType = 0
Container_M.CursorLocation = 2
Container_M.LockType = 1
Container_M.Open()
Container_M_numRows = 0
%>
<%
Dim UGN_Facility_M
Dim UGN_Facility_M_numRows
Set UGN_Facility_M = Server.CreateObject("ADODB .Recordset ")
UGN_Facility_M.ActiveConne ction = MM_UGN_DB_STRING
UGN_Facility_M.Source = "Select UGNFacility, UGNFacilityName from UGN_Facility_M Where UGNFacility < 15 Order By UGNFacility"
UGN_Facility_M.CursorType = 0
UGN_Facility_M.CursorLocat ion = 2
UGN_Facility_M.LockType = 1
UGN_Facility_M.Open()
UGN_Facility_M_numRows = 0
%>
<%
Dim UGN_Dept_M
Dim UGN_Dept_M_numRows
Set UGN_Dept_M = Server.CreateObject("ADODB .Recordset ")
UGN_Dept_M.ActiveConnectio n = MM_UGN_DB_STRING
UGN_Dept_M.Source = "Select UGNDeptNo, UGNDeptName from UGN_Dept_M Where UGNDeptNo > 0 Order By UGNDeptName"
UGN_Dept_M.CursorType = 0
UGN_Dept_M.CursorLocation = 2
UGN_Dept_M.LockType = 1
UGN_Dept_M.Open()
UGN_Dept_M_numRows = 0
%>
<html><!-- InstanceBegin template="file:///C|/Inetp ub/wwwroot /Main Menu/Templates/temp_red.dw t" codeOutsideHTMLIsLocked="f alse" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Instruction List</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<script language="JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_pre loadImages .arguments ; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
<!--
function TJK_noWayBack(){// http://www.MadCoWWWebDesign.com - Thierry Koblentz
history.go(1);
}
TJK_noWayBack();
//-->
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="TJK_noWayBack()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2" bgcolor="#666666"> <img src="http://ugndb/onTrack/images/luxury.png" name="image" width="125" height="50">
</td>
<td width="100%" bgcolor="#CCCCCC"><font color="#de192b" size="1" face="Verdana, Arial, Helvetica, sans-serif">
<strong>UGN, Inc.</strong></font></td>
</tr>
<tr>
<td align="left" valign="bottom" bgcolor="#CCCCCC"><strong> <font size="-1">Your
logged in as <font color="#de192b" size="1" face="Verdana, Arial, Helvetica, sans-serif">
<strong><%=Session("MM_Use rName")%>< /strong></ font> .</font></strong></td>
</tr>
</table>
<!-- InstanceBeginEditable name="Body" -->
<table width="100%" border="0" cellspacing="2" cellpadding="4" align="center">
<tr bgcolor="#333333">
<td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td nowrap bgcolor="#de192b"><font color="#CCCCCC" size="1"><b>Quick
Links</b></font></td>
</tr>
</table>
</td>
<td width="88%">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td bgcolor="#de192b"> &n bsp;</td>
<td width="100%"> <font color="#CCCCCC"> <b>Create/Modify Packaging
Layout</b></font></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="123%" border="0" cellspacing="4" cellpadding="4" align="center">
<tr>
<td width="12%" valign="top">
<table>
<tr>
<td height="21"><a href="Packaging_Module_Men u.asp"><im g src="../images/pkgm.gif" width="108" height="19" border="0"></a></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><hr>
</td>
</tr>
<tr>
<td><strong><a href="http://ugndb/ugnmainmenu/Main_Menu.asp?<%="UgnFacility=" & Session("MM_EmpUGNfacility ") %>"><img src="../images/bugn.gif" width="108" height="29" border="0"></a></strong></ td>
</tr>
<tr>
<td><strong><font size="-1"><a href="<%= MM_Logout %>"><img src="../images/bso.gif" width="108" height="18" border="0"></a></font></st rong></td>
</tr>
</table>
<p><strong></strong></p> <strong></strong><strong>< /strong><s trong></st rong><stro ng></stron g><strong> <font color="#000000"> </fo nt></stron g></td>
<td width="88%" valign="top"> <table width="79%" border="0">
<tr>
<td bordercolor="#FFFFFF">
<form METHOD="POST" name="form1" action="<%=MM_editAction%> ">
<table width="715" border="0">
<tr>
<td width="124"><div align="right"><strong><fon t size="-1"><font color="#990000">*</font>Pa rt Number :</font></strong></div></t d>
<td width="182"><input name="CartName" type="text" id="CartName" value="<%=(Cart_M.Fields.I tem("CartN ame").Valu e)%>"></td >
<td width="103"><div align="right"><strong><fon t size="-1">Container No: </font></strong></div></td >
<td width="212"><select name="ContainerNo" id="ContainerNo">
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("Containe rNo").Valu e))) Then If ("" = CStr((Cart_M.Fields.Item(" ContainerN o").Value) )) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<%
While (NOT Container_M.EOF)
%>
<option value="<%=(Container_M.Fie lds.Item(" ContainerN o").Value) %>" <%If (Not isNull((Cart_M.Fields.Item ("Containe rNo").Valu e))) Then If (CStr(Container_M.Fields.I tem("Conta inerNo").V alue) = CStr((Cart_M.Fields.Item(" ContainerN o").Value) )) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(Container_M.Fields.It em("Contai nerNo").Va lue)%></op tion>
<%
Container_M.MoveNext()
Wend
If (Container_M.CursorType > 0) Then
Container_M.MoveFirst
Else
Container_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon t size="-1"><font color="#990000">*</font>Cu stomer: </font></strong></div></td >
<td><select name="CustId" id="CustId" onchange="custplantrefresh ()">
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("CustId") .Value))) Then If ("" = CStr((Cart_M.Fields.Item(" CustId").V alue))) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<%
While (NOT Cust_M.EOF)
%>
<option value="<%=(Cust_M.Fields.I tem("CustI d").Value) %>" <%If (Not isNull((Cart_M.Fields.Item ("CustId") .Value))) Then If (CStr(Cust_M.Fields.Item(" CustId").V alue) = CStr((Cart_M.Fields.Item(" CustId").V alue))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(Cust_M.Fields.Item("C ustName"). Value)%></ option>
<%
Cust_M.MoveNext()
Wend
If (Cust_M.CursorType > 0) Then
Cust_M.MoveFirst
Else
Cust_M.Requery
End If
%>
</select></td>
<td><div align="right"><strong><fon t size="-1"><font color="#990000">*</font>Cu stomer Plant:</font></strong></di v></td>
<td><select name="CustPlant" id="CustPlant">
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("CustPlan t").Value) )) Then If ("" = CStr((Cart_M.Fields.Item(" CustPlant" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<%
While (NOT Cust_Plant_M.EOF)
%>
<option value="<%=(Cust_Plant_M.Fi elds.Item( "CustPlant ").Value)% >" <%If (Not isNull((Cart_M.Fields.Item ("CustPlan t").Value) )) Then If (CStr(Cust_Plant_M.Fields. Item("Cust Plant").Va lue) = CStr((Cart_M.Fields.Item(" CustPlant" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(Cust_Plant_M.Fields.I tem("CustP lantName") .Value)%>< /option>
<%
Cust_Plant_M.MoveNext()
Wend
If (Cust_Plant_M.CursorType > 0) Then
Cust_Plant_M.MoveFirst
Else
Cust_Plant_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon t size="-1">Model Year:</font></strong></div ></td>
<td><select name="modelyear">
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<option value="1991" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1991" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1991< /option>
<option value="1992" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1992" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1992< /option>
<option value="1993" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1993" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1993< /option>
<option value="1994" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1994" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1994< /option>
<option value="1995" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1995" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1995< /option>
<option value="1996" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1996" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1996< /option>
<option value="1997" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1997" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1997< /option>
<option value="1998" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1998" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1998< /option>
<option value="1999" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1999" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1999< /option>
<option value="2000" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2000" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2000< /option>
<option value="2001" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2001" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2001< /option>
<option value="2002" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2002" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2002< /option>
<option value="2003" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2003" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2003< /option>
<option value="2004" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2004" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2004< /option>
<option value="2005" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2005" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2005< /option>
<option value="2006" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2006" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2006< /option>
<option value="2007" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2007" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2007< /option>
<option value="2008" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2008" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2008< /option>
<option value="2009" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2009" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2009< /option>
<option value="2010" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2010" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2010< /option>
<option value="2011" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2011" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2011< /option>
<option value="2012" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2012" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2012< /option>
<option value="2013" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2013" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2013< /option>
<option value="2014" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2014" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2014< /option>
<option value="2015" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2015" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2015< /option>
<option value="2016" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2016" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2016< /option>
<option value="2017" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2017" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2017< /option>
<option value="2018" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2018" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2018< /option>
<option value="2019" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2019" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2019< /option>
<option value="2020" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2020" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2020< /option>
</select></td>
<td><div align="right"><strong><fon t size="-1">Model:</font></s trong></di v></td>
<td><input name="Model" type="text" id="Model" value="<%=(Cart_M.Fields.I tem("Model ").Value)% >"></td>
</tr>
<tr>
<td><div align="right"><strong><fon t size="-1">UGN Facility:</font></strong>< /div></td>
<td><select name="UGNFacility" id="UGNFacility">
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("UGNFacil ity").Valu e))) Then If ("" = CStr((Cart_M.Fields.Item(" UGNFacilit y").Value) )) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<%
While (NOT UGN_Facility_M.EOF)
%>
<option value="<%=(UGN_Facility_M. Fields.Ite m("UGNFaci lity").Val ue)%>" <%If (Not isNull((Cart_M.Fields.Item ("UGNFacil ity").Valu e))) Then If (CStr(UGN_Facility_M.Field s.Item("UG NFacility" ).Value) = CStr((Cart_M.Fields.Item(" UGNFacilit y").Value) )) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(UGN_Facility_M.Fields .Item("UGN FacilityNa me").Value )%></optio n>
<%
UGN_Facility_M.MoveNext()
Wend
If (UGN_Facility_M.CursorType > 0) Then
UGN_Facility_M.MoveFirst
Else
UGN_Facility_M.Requery
End If
%>
</select></td>
<td><div align="right"><strong><fon t size="-1">UGN Department: </font></strong></div></td >
<td><select name="UGNDeptNo" id="UGNDeptNo">
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("UGNDeptN o").Value) )) Then If ("" = CStr((Cart_M.Fields.Item(" UGNDeptNo" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<%
While (NOT UGN_Dept_M.EOF)
%>
<option value="<%=(UGN_Dept_M.Fiel ds.Item("U GNDeptNo") .Value)%>" <%If (Not isNull((Cart_M.Fields.Item ("UGNDeptN o").Value) )) Then If (CStr(UGN_Dept_M.Fields.It em("UGNDep tNo").Valu e) = CStr((Cart_M.Fields.Item(" UGNDeptNo" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(UGN_Dept_M.Fields.Ite m("UGNDept Name").Val ue)%></opt ion>
<%
UGN_Dept_M.MoveNext()
Wend
If (UGN_Dept_M.CursorType > 0) Then
UGN_Dept_M.MoveFirst
Else
UGN_Dept_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon t size="-1">Revision Date:</font></strong></div ></td>
<td><input name="RevisionDate" type="text" id="RevisionDate" onChange=CheckDate(this.fo rm.Revisio nDate) value="<%=(Cart_M.Fields.I tem("Revis ionDate"). Value)%>" ></td>
<td><div align="right"><strong><fon t size="-1">Employee:</font> </strong>< /div></td>
<td><select name="EmpId" >
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("EmpId"). Value))) Then If ("" = CStr((Cart_M.Fields.Item(" EmpId").Va lue))) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<%
While (NOT Employee_M.EOF)
%>
<option value="<%=(Employee_M.Fiel ds.Item("E mpId").Val ue)%>" <%If (Not isNull((Cart_M.Fields.Item ("EmpId"). Value))) Then If (CStr(Employee_M.Fields.It em("EmpId" ).Value) = CStr((Cart_M.Fields.Item(" EmpId").Va lue))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(Employee_M.Fields.Ite m("EmpName ").Value)% ></option>
<%
Employee_M.MoveNext()
Wend
If (Employee_M.CursorType > 0) Then
Employee_M.MoveFirst
Else
Employee_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon t size="-1">Single/Multiple Part :</font></strong></div></t d>
<td><select name="SingleMultiPartFlag" id="SingleMultiPartFlag">
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("SingleMu ltiPartFla g").Value) )) Then If ("" = CStr((Cart_M.Fields.Item(" SingleMult iPartFlag" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<option value="S" <%If (Not isNull((Cart_M.Fields.Item ("SingleMu ltiPartFla g").Value) )) Then If ("S" = CStr((Cart_M.Fields.Item(" SingleMult iPartFlag" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>Singl e</option>
<option value="M" <%If (Not isNull((Cart_M.Fields.Item ("SingleMu ltiPartFla g").Value) )) Then If ("M" = CStr((Cart_M.Fields.Item(" SingleMult iPartFlag" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>Multi ple</optio n>
</select></td>
<td><div align="right"><strong><fon t size="-1">Gross Weight: </font></strong></div></td >
<td><input name="GrossWeight" type="text" id="GrossWeight" onBlur="CheckGrossWeight(t his.form.G rossWeight )" value="<%=(Cart_M.Fields.I tem("Gross Weight").V alue)%>" maxlength="6"></td>
</tr>
<tr>
<td><div align="right"><strong><fon t size="-1">Is Published:</font></strong> </div></td >
<td><select name="IsPublished" id="IsPublished">
<option value="0" <%If (Not isNull((Cart_M.Fields.Item ("IsPublis hed").Valu e))) Then If ("0" = CStr((Cart_M.Fields.Item(" IsPublishe d").Value) )) Then Response.Write("SELECTED") : Response.Write("")%>>No</o ption>
<option value="1" selected <%If (Not isNull((Cart_M.Fields.Item ("IsPublis hed").Valu e))) Then If ("1" = CStr((Cart_M.Fields.Item(" IsPublishe d").Value) )) Then Response.Write("SELECTED") : Response.Write("")%>>Yes</ option>
</select></td>
<td> </td>
<td><div align="right">
<input name="previewbutton" type="button" id="previewbutton" value="Preview" onclick="previewbuttonclic k()">
<input type="submit" name="Submit" onClick="return savebuttonclick()" value="Save">
<input type="button" name="Button" onClick="return deletebuttonclick('Part Record to be Deleted?')" value="Delete">
</div></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="MM_recordId" value="<%= Cart_M.Fields.Item("CartNa me").Value %>">
<input type="hidden" name="MM_QueryString" value="<%=Request.QueryStr ing%>">
<%
Response.Write ("<script language='JavaScript'>chec kfields(); </script>" )
%>
</form>
</td>
</tr>
<tr>
<td bordercolor="#FFFFFF"><img src="images/picture.png" width="598" height="27" border="0" usemap="#Map">
<map name="Map">
<area shape="rect" coords="15,2,95,23" href="Part_Detail_List.asp ?CartName= <%=Cart_M( "CartName" )%>&CustId =<%=Cart_M ("CustId") %>&CustPla nt=<%=Cart _M("CustPl ant")%>">
<area shape="rect" coords="121,2,210,23" href="Instructions_List.as p?CartName =<%=Cart_M ("CartName ")%>&CustI d=<%=Cart_ M("CustId" )%>&CustPl ant=<%=Car t_M("CustP lant")%>">
</map>
</td>
</tr>
<tr>
<td bordercolor="#FFFFFF"><tab le width="96%" border="1">
<tr><td height="51"><form name="form2" method="POST" enctype="multipart/form-da ta" onSubmit="return filetypecheck()" action="Insert.asp?CartNam e=<%=Reque st.QuerySt ring("Cart Name")%>&C ustId=<%=R equest.Que ryString(" CustId")%> &CustPlant =<%=Reques t.QueryStr ing("CustP lant")%>">
<p>File to Upload: <input name="file" type="file" onchange="checkfiletype(th is.value)" size=80><br> <br>
<input name="UploadButton" type="submit" style="margin-top:2" value="Upload" >
<input name="Submit2" type="hidden" onClick="MM_goToURL('paren t','RFC_Up date.asp?R FQNo=<%=Re quest.Quer yString("R FQNo")%>&r f=<%=Reque st.QuerySt ring("rf") %>&orig=<% =Request.Q ueryString ("orig")%> &qe=<%=Req uest.Query String("qe ")%>&co=<% =Request.Q ueryString ("co")%>&c d=<%=Reque st.QuerySt ring("cd") %>&sa=<%=R equest.Que ryString(" sa")%>');r eturn document.MM_returnValue" value="Cancel">
<%
Response.Write ("<script language='JavaScript'>chec kfieldsfor m2();</scr ipt>")
%>
</p>
<p>
<input type="image" border="0" name="imageField" src="file.asp?Cartname=<%= Request.Qu eryString( "Cartname" )%>&CustId =<%=Reques t.QueryStr ing("CustI d")%>&Cust Plant=<%=R equest.Que ryString(" CustPlant" )%>" width="600" height="400" >
</p>
</form></td>
</tr>
</table>
<p> </p></td>
</tr>
</table> <p> </p>
</td>
</tr>
</table>
<!-- InstanceEndEditable --><br>
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#CCCCCC">
<tr>
<td width="23%"> <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">©2003
UGN, Inc. </font></td>
<td width="77%" align="right"> </td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>
<%
Cart_M.Close()
Set Cart_M = Nothing
%>
<%
Cust_M.Close()
Set Cust_M = Nothing
%>
<%
Cust_Plant_M.Close()
Set Cust_Plant_M = Nothing
%>
<%
Employee_M.Close()
Set Employee_M = Nothing
%>
<%
Container_M.Close()
Set Container_M = Nothing
%>
<%
UGN_Facility_M.Close()
Set UGN_Facility_M = Nothing
%>
<%
UGN_Dept_M.Close()
Set UGN_Dept_M = Nothing
%>
------
Loader.asp
<%
' -- Loader.asp --
' -- version 1.5.2
' -- last updated 12/5/2002
'
' Faisal Khan
' faisal@stardeveloper.com
' www.stardeveloper.com
' Class for handling binary uploads
Class Loader
Private dict
Private Sub Class_Initialize
Set dict = Server.CreateObject("Scrip ting.Dicti onary")
End Sub
Private Sub Class_Terminate
If IsObject(intDict) Then
intDict.RemoveAll
Set intDict = Nothing
End If
If IsObject(dict) Then
dict.RemoveAll
Set dict = Nothing
End If
End Sub
Public Property Get Count
Count = dict.Count
End Property
Public Sub Initialize
If Request.TotalBytes > 0 Then
Dim binData
binData = Request.BinaryRead(Request .TotalByte s)
getData binData
End If
End Sub
Public Function getFileData(name)
If dict.Exists(name) Then
getFileData = dict(name).Item("Value")
Else
getFileData = ""
End If
End Function
Public Function getValue(name)
Dim gv
If dict.Exists(name) Then
gv = CStr(dict(name).Item("Valu e"))
gv = Left(gv,Len(gv)-2)
getValue = gv
Else
getValue = ""
End If
End Function
Public Function saveToFile(name, path)
If dict.Exists(name) Then
Dim temp
temp = dict(name).Item("Value")
Dim fso
Set fso = Server.CreateObject("Scrip ting.FileS ystemObjec t")
Dim file
Set file = fso.CreateTextFile(path)
For tPoint = 1 to LenB(temp)
file.Write Chr(AscB(MidB(temp,tPoint, 1)))
Next
file.Close
saveToFile = True
Else
saveToFile = False
End If
End Function
Public Function getFileName(name)
If dict.Exists(name) Then
Dim temp, tempPos
temp = dict(name).Item("FileName" )
tempPos = 1 + InStrRev(temp, "\")
getFileName = Mid(temp, tempPos)
Else
getFileName = ""
End If
End Function
Public Function getFilePath(name)
If dict.Exists(name) Then
Dim temp, tempPos
temp = dict(name).Item("FileName" )
tempPos = InStrRev(temp, "\")
getFilePath = Mid(temp, 1, tempPos)
Else
getFilePath = ""
End If
End Function
Public Function getFilePathComplete(name)
If dict.Exists(name) Then
getFilePathComplete = dict(name).Item("FileName" )
Else
getFilePathComplete = ""
End If
End Function
Public Function getFileSize(name)
If dict.Exists(name) Then
getFileSize = LenB(dict(name).Item("Valu e"))
Else
getFileSize = 0
End If
End Function
Public Function getFileSizeTranslated(name )
If dict.Exists(name) Then
temp = 1 + LenB(dict(name).Item("Valu e"))
If Len(temp) <= 3 Then
getFileSizeTranslated = temp & " bytes"
ElseIf Len(temp) > 6 Then
temp = FormatNumber(((temp / 1024) / 1024), 2)
getFileSizeTranslated = temp & " megabytes"
Else
temp = FormatNumber((temp / 1024), 2)
getFileSizeTranslated = temp & " kilobytes"
End If
Else
getFileSizeTranslated = ""
End If
End Function
Public Function getContentType(name)
If dict.Exists(name) Then
getContentType = dict(name).Item("ContentTy pe")
Else
getContentType = ""
End If
End Function
Private Sub getData(rawData)
Dim separator
separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)
Dim lenSeparator
lenSeparator = LenB(separator)
Dim currentPos
currentPos = 1
Dim inStrByte
inStrByte = 1
Dim value, mValue
Dim tempValue
tempValue = ""
While inStrByte > 0
inStrByte = InStrB(currentPos, rawData, separator)
mValue = inStrByte - currentPos
If mValue > 1 Then
value = MidB(rawData, currentPos, mValue)
Dim begPos, endPos, midValue, nValue
Dim intDict
Set intDict = Server.CreateObject("Scrip ting.Dicti onary")
begPos = 1 + InStrB(1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))
nValue = endPos
Dim nameN
nameN = MidB(value, begPos, endPos - begPos)
Dim nameValue, isValid
isValid = True
If InStrB(1, value, stringToByte("Content-Type ")) > 1 Then
begPos = 1 + InStrB(endPos + 1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))
If endPos = 0 Then
endPos = begPos + 1
isValid = False
End If
midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "FileName", trim(byteToString(midValue ))
begPos = 14 + InStrB(endPos + 1, value, stringToByte("Content-Type :"))
endPos = InStrB(begPos, value, ChrB(13))
midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "ContentType", trim(byteToString(midValue ))
begPos = endPos + 4
endPos = LenB(value)
nameValue = MidB(value, begPos, ((endPos - begPos) - 1))
Else
nameValue = trim(byteToString(MidB(val ue, nValue + 5)))
End If
If isValid = True Then
intDict.Add "Value", nameValue
intDict.Add "Name", nameN
dict.Add byteToString(nameN), intDict
End If
End If
currentPos = lenSeparator + inStrByte
Wend
End Sub
End Class
Private Function stringToByte(toConv)
Dim tempChar
For i = 1 to Len(toConv)
tempChar = Mid(toConv, i, 1)
stringToByte = stringToByte & chrB(AscB(tempChar))
Next
End Function
Private Function byteToString(toConv)
For i = 1 to LenB(toConv)
byteToString = byteToString & chr(AscB(MidB(toConv,i,1)) )
Next
End Function
%>
----X----X----
My field type in table in IMAGE. I need step 2 and 3. Because, I dont want to Upload .BMP file in to database. It is too big. So, I have to convert it in to .jpg.
Code for 'Select file(through browser) at client machine, and upload that .jpg file in to SQL Server database' is as below. It takes file from browser and then upload it to database. While I want to pick up file from Server hard disk and upload it to database.
----
insert.asp
<!--#include file="Loader.asp"-->
<%
Response.Buffer = True
' load object
Dim load
Set load = new Loader
' calling initialize method
load.initialize
' File binary data
Dim fileData
fileData = load.getFileData("file")
' File name
Dim fileName
fileName = LCase(load.getFileName("fi
' File path
Dim filePath
filePath = load.getFilePath("file")
' File path complete
Dim filePathComplete
filePathComplete = load.getFilePathComplete("
' File size
Dim fileSize
fileSize = load.getFileSize("file")
' File size translated
Dim fileSizeTranslated
fileSizeTranslated = load.getFileSizeTranslated
' Content Type
Dim contentType
contentType = load.getContentType("file"
' No. of Form elements
Dim countElements
countElements = load.Count
' Value of text input field "fname"
Dim fnameInput
fnameInput = load.getValue("fname")
' Value of text input field "lname"
Dim lnameInput
lnameInput = load.getValue("lname")
' Value of text input field "profession"
Dim profession
profession = load.getValue("profession"
' destroying load object
Set load = Nothing
%>
<html>
<head>
<title>Inserts Images into Database</title>
<style>
body, input, td { font-family:verdana,arial;
</style>
</head>
<body>
<p align="center">
<b>Inserting Binary Data into Database</b><br>
<a href="show.asp">To see inserted data click here</a>
</p>
<%
CartName = Request.QueryString("CartN
CustId = Request.QueryString("CustI
CustPlant = Request.QueryString("CustP
%>
<table width="700" border="1" align="center">
<tr>
<td>File Name</td><td><%= fileName %></td>
</tr><tr>
<td>File Path</td><td><%= filePath %></td>
</tr><tr>
<td>File Path Complete</td><td><%= filePathComplete %></td>
</tr><tr>
<td>File Size</td><td><%= fileSize %></td>
</tr><tr>
<td>File Size Translated</td><td><%= fileSizeTranslated %></td>
</tr><tr>
<td>Content Type</td><td><%= contentType %></td>
</tr><tr>
<td>No. of Form Elements</td><td><%= countElements %></td>
</tr>
</table><br><br>
<p style="padding-left:220;">
<%= fileName %> data received ...<br>
<%
' Checking to make sure if file was uploaded
If fileSize > 0 Then
' Connection string
Dim connStr
set connStr = Server.CreateObject("ADODB
connStr.open = "dsn=Test_UGN_DB_DSN;uid=s
' Recordset object
Dim rs
Set rs = Server.CreateObject("ADODB
sqltext = "select cartname, contenttypepicture3, Picture3Size, Picture3 from Cart_M where CartName = '" & CartName & "' and Cart_M.CustId = " & CustId & " and Cart_M.CustPlant = '" & CustPlant & "'"
rs.Open sqltext, connStr, 2, 4
' Adding data
rs("Picture3Size") = fileSize
rs("Picture3").AppendChunk
rs("contenttypepicture3") = contentType
rs.UpdateBatch
rs.Close
Set rs = Nothing
Response.Write "<font color=""green"">File was successfully uploaded...</font>"
Else
Response.Write "<font color=""brown"">No file was selected for uploading...</font>"
End If
If Err.number <> 0 Then
Response.Write "<br><font color=""red"">Something went wrong...</font>"
End If
response.redirect("Picture
%>
</p>
<br>
</body>
</html>
--------------------
Picture_Upload.asp
<%@LANGUAGE="VBSCRIPT"%>
<!-- #include file="UploadFile.asp" -->
<!-- #include file="../Connections/UGN_D
<script language = "JavaScript">
function isDigit(theDigit)
{
var digitArray = new Array('0','1','2','3','4',
for (j = 0; j < digitArray.length; j++)
{if (theDigit == digitArray[j])
return true
}
return false
}
/*************************
/*Function name :isPositiveInteger(theStri
/*Usage of this function :test for an +ve integer */
/*Input parameter required:thedata=string for test whether is +ve integer*/
/*Return value :if is +ve integer,return true */
/* else return false */
/*function require :isDigit */
/*************************
function isPositiveInteger(theStrin
{
var theData = new String(theString)
if (!isDigit(theData.charAt(0
if (!(theData.charAt(0)== '+'))
return false
for (var i = 1; i < theData.length; i++)
if (!isDigit(theData.charAt(i
return false
return true
}
/*************************
/*Function name :isDate(s,f) */
/*Usage of this function :To check s is a valid format */
/*Input parameter required:s=input string */
/* f=input string format */
/* =1,in mm/dd/yyyy format */
/* else in dd/mm/yyyy */
/*Return value :if is a valid date return 1 */
/* else return 0 */
/*Function required :isPositiveInteger() */
/*************************
function isDate(s,f)
{
var a1=s.split("/");
var a2=s.split("-");
var e=true;
if ((a1.length!=3) && (a2.length!=3))
{
e=false;
}
else
{if (a1.length==3)
var na=a1;
if (a2.length==3)
var na=a2;
if (isPositiveInteger(na[0]) && isPositiveInteger(na[1]) && isPositiveInteger(na[2]))
{ if (f==1)
{var d=na[1],m=na[0];
}
else
{var d=na[0],m=na[1];
}
var y=na[2];
if (((e) && (y<1000)||y.length>4))
e=false
if (e)
{
v=new Date(m+"/"+d+"/"+y);
if (v.getMonth()!=m-1)
e=false;
}
}
else
{
e=false;
}
}
return e
}
function CheckDate(v)
{
var s=v.value;
if (!(s == ""))
{
if (!(isDate(s,1))) //dd/mm/yyyy format
{
alert("The inputed date value is not valid. Please Enter date in mm/dd/yyyy format");
document.form1.CartName.fo
v.value = "";
v.focus();
return false;
}
}
}
function CheckGrossWeight(v)
{
var s=v.value;
if (isNaN(s))
{
alert("Please enter Gross Weight using numeric characters only! Your entered value '" + s + "' is not numeric.");
document.form1.CartName.fo
v.value = "";
v.focus();
return false;
}
}
function CheckQtyPacked(v)
{
var s=v.value;
if (isNaN(s))
{
alert("Please enter Qty Packed using numeric characters only! Your entered value '" + s + "' is not numeric.");
//document.form2.qtypacked
v.value = "";
v.focus();
return false;
}
}
function deletebuttonclick(msg)
{
//confirm(msg);
var x=window.confirm(msg)
if (x)
{
location.href = "Cart_Delete.asp?" + document.form1.MM_QueryStr
return true;
}
else
{
//alert("Not Agree");
}
}
function uploadbuttonclick(uploaded
{
alert("uploadedfile = " + uploadedfile.value );
newWindow = window.open();
newWindow.location.href = "Picture_Upload_Action.asp
}
function previewbuttonclick()
{
newWindow = window.open();
newWindow.location.href = "rpt_packaging_layout.asp?
}
function checkfiletype(thevalue)
{
var regx = new RegExp(".jpg$","i")
if (regx.test(thevalue))
{
//alert("Cool")
return true;
}
else
{
alert("Please Select only .jpg fles")
document.form2.Submit2.foc
document.form2.file.value = "";
thevalue.focus;
return false;
}
}
function filetypecheck()
{
var regx = new RegExp(".jpg$","i")
if (regx.test(document.form2.
{
//alert("Cool")
return true;
}
else
{
alert("Please Select only .jpg fles")
return false;
}
}
function checkfields()
{
var num = document.form1.elements.le
var localpcks002 = "<%=session("PCKS002")%>";
var ugnDeptNo = "<%=session("MM_UGNDeptNo"
var ugnUserId = "<%=session("MM_UserId")%>
//alert("localpcks001 = " + localpcks001 + ", ugnDeptNo = " + ugnDeptNo + ", ugnUserId = " + ugnUserId );
for (var i=0; i<num;i++)
{
if ( localpcks002 == "E" ) //Packaging Dept user will have EDIT rights
{
document.form1.elements[i]
}
else //// Select/ReadOnly. None of above condition satisfied then disable all fields.
{
document.form1.elements[i]
}
}
} // end of function checkfields()
function checkfieldsform2()
{
var num = document.form2.elements.le
var localpcks002 = "<%=session("PCKS002")%>";
var ugnDeptNo = "<%=session("MM_UGNDeptNo"
var ugnUserId = "<%=session("MM_UserId")%>
//alert("localpcks001 = " + localpcks001 + ", ugnDeptNo = " + ugnDeptNo + ", ugnUserId = " + ugnUserId );
for (var i=0; i<num;i++)
{
if ( localpcks002 == "E" ) //Packaging Dept user will have EDIT rights
{
document.form2.elements[i]
}
else //// Select/ReadOnly. None of above condition satisfied then disable all fields.
{
document.form2.elements[i]
}
}
} // end of function checkfieldsform2()
</script>
<%
' *** Logout the current user.
MM_Logout = CStr(Request.ServerVariabl
If (CStr(Request("MM_Logoutno
Session.Contents.Remove("M
Session.Contents.Remove("M
MM_logoutRedirectPage = "../ugndb_login.asp"
' redirect with URL parameters (remove the "MM_Logoutnow" query param).
if (MM_logoutRedirectPage = "") Then MM_logoutRedirectPage = CStr(Request.ServerVariabl
If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_newQS = "?"
For Each Item In Request.QueryString
If (Item <> "MM_Logoutnow") Then
If (Len(MM_newQS) > 1) Then MM_newQS = MM_newQS & "&"
MM_newQS = MM_newQS & Item & "=" & Server.URLencode(Request.Q
End If
Next
if (Len(MM_newQS) > 1) Then MM_logoutRedirectPage = MM_logoutRedirectPage & MM_newQS
End If
Response.Redirect(MM_logou
End If
%>
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariabl
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables
If (CStr(Request("MM_update")
MM_editConnection = MM_UGN_DB_STRING
MM_editTable = "dbo.Cart_M"
MM_editColumn = "CartName"
MM_recordId = "'" + Request.Form("MM_recordId"
MM_editRedirectUrl = "Picture_Upload.asp"
MM_fieldsStr = "CartName|value|ContainerN
MM_columnsStr = "CartName|',none,''|Contai
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_field
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Update Record: construct a sql update statement and execute it
If (CStr(Request("MM_update")
' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),"
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject("ADODB
MM_editCmd.ActiveConnectio
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnectio
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editR
End If
End If
End If
%>
<%
Dim Cart_M__vCartName
Cart_M__vCartName = "%"
If (Request.QueryString("Cart
Cart_M__vCartName = Request.QueryString("CartN
End If
%>
<%
Dim Cart_M__vCustId
Cart_M__vCustId = "0"
If (Request.QueryString("Cust
Cart_M__vCustId = Request.QueryString("CustI
End If
%>
<%
Dim Cart_M__VCustPlant
Cart_M__VCustPlant = "%"
If (Request.QueryString("Cust
Cart_M__VCustPlant = Request.QueryString("CustP
End If
%>
<%
Dim Cart_M
Dim Cart_M_numRows
Set Cart_M = Server.CreateObject("ADODB
Cart_M.ActiveConnection = MM_UGN_DB_STRING
Cart_M.Source = "SELECT CartName, ContainerNo, RevisionDate, CustId, CustPlant, Model, ModelYear, EmpId, GrossWeight, IsPublished, UGNFacility, UGNDeptNo, SingleMultiPartFlag FROM Cart_M WHERE Cart_M.CartName = '" + Replace(Cart_M__vCartName,
'response.write("Cart_M.So
'response.end
Cart_M.CursorType = 0
Cart_M.CursorLocation = 2
Cart_M.LockType = 1
Cart_M.Open()
Cart_M_numRows = 0
%>
<%
Dim Cust_M
Dim Cust_M_numRows
Set Cust_M = Server.CreateObject("ADODB
Cust_M.ActiveConnection = MM_UGN_DB_STRING
Cust_M.Source = "SELECT Cust_M.CustId, Cust_M.CustName FROM Cust_M ORDER BY CustName "
Cust_M.CursorType = 0
Cust_M.CursorLocation = 2
Cust_M.LockType = 1
Cust_M.Open()
Cust_M_numRows = 0
%>
<%
Dim Cust_Plant_M
Dim Cust_Plant_M_numRows
Set Cust_Plant_M = Server.CreateObject("ADODB
Cust_Plant_M.ActiveConnect
Cust_Plant_M.Source = "SELECT Cust_Plant_M.CustPlant, Cust_M.CustName + '-> ' + Cust_Plant_M.CustPlant as CustPlantName FROM Cust_M, Cust_Plant_M Where Cust_M.CustId = Cust_Plant_M.CustId ORDER BY Cust_M.CustName, Cust_Plant_M.CustPlant "
Cust_Plant_M.CursorType = 0
Cust_Plant_M.CursorLocatio
Cust_Plant_M.LockType = 1
Cust_Plant_M.Open()
Cust_Plant_M_numRows = 0
%>
<%
Dim Employee_M
Dim Employee_M_numRows
Set Employee_M = Server.CreateObject("ADODB
Employee_M.ActiveConnectio
Employee_M.Source = "SELECT EmpId, EmplastName + ', ' + EmpFirstName AS EmpName FROM Employee_M WHERE EmpStatus='Working' ORDER BY EmplastName +' '+ EmpFirstName"
Employee_M.CursorType = 0
Employee_M.CursorLocation = 2
Employee_M.LockType = 1
Employee_M.Open()
Employee_M_numRows = 0
%>
<%
Dim Container_M
Dim Container_M_numRows
Set Container_M = Server.CreateObject("ADODB
Container_M.ActiveConnecti
Container_M.Source = "SELECT Container_M.ContainerNo FROM Container_M ORDER BY Container_M.ContainerNo"
Container_M.CursorType = 0
Container_M.CursorLocation
Container_M.LockType = 1
Container_M.Open()
Container_M_numRows = 0
%>
<%
Dim UGN_Facility_M
Dim UGN_Facility_M_numRows
Set UGN_Facility_M = Server.CreateObject("ADODB
UGN_Facility_M.ActiveConne
UGN_Facility_M.Source = "Select UGNFacility, UGNFacilityName from UGN_Facility_M Where UGNFacility < 15 Order By UGNFacility"
UGN_Facility_M.CursorType = 0
UGN_Facility_M.CursorLocat
UGN_Facility_M.LockType = 1
UGN_Facility_M.Open()
UGN_Facility_M_numRows = 0
%>
<%
Dim UGN_Dept_M
Dim UGN_Dept_M_numRows
Set UGN_Dept_M = Server.CreateObject("ADODB
UGN_Dept_M.ActiveConnectio
UGN_Dept_M.Source = "Select UGNDeptNo, UGNDeptName from UGN_Dept_M Where UGNDeptNo > 0 Order By UGNDeptName"
UGN_Dept_M.CursorType = 0
UGN_Dept_M.CursorLocation = 2
UGN_Dept_M.LockType = 1
UGN_Dept_M.Open()
UGN_Dept_M_numRows = 0
%>
<html><!-- InstanceBegin template="file:///C|/Inetp
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Instruction List</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<script language="JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_pre
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
<!--
function TJK_noWayBack(){// http://www.MadCoWWWebDesign.com - Thierry Koblentz
history.go(1);
}
TJK_noWayBack();
//-->
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="TJK_noWayBack()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2" bgcolor="#666666"> <img src="http://ugndb/onTrack/images/luxury.png" name="image" width="125" height="50">
</td>
<td width="100%" bgcolor="#CCCCCC"><font color="#de192b" size="1" face="Verdana, Arial, Helvetica, sans-serif">
<strong>UGN, Inc.</strong></font></td>
</tr>
<tr>
<td align="left" valign="bottom" bgcolor="#CCCCCC"><strong>
logged in as <font color="#de192b" size="1" face="Verdana, Arial, Helvetica, sans-serif">
<strong><%=Session("MM_Use
</tr>
</table>
<!-- InstanceBeginEditable name="Body" -->
<table width="100%" border="0" cellspacing="2" cellpadding="4" align="center">
<tr bgcolor="#333333">
<td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td nowrap bgcolor="#de192b"><font color="#CCCCCC" size="1"><b>Quick
Links</b></font></td>
</tr>
</table>
</td>
<td width="88%">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td bgcolor="#de192b"> &n
<td width="100%"> <font color="#CCCCCC"> <b>Create/Modify Packaging
Layout</b></font></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="123%" border="0" cellspacing="4" cellpadding="4" align="center">
<tr>
<td width="12%" valign="top">
<table>
<tr>
<td height="21"><a href="Packaging_Module_Men
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><hr>
</td>
</tr>
<tr>
<td><strong><a href="http://ugndb/ugnmainmenu/Main_Menu.asp?<%="UgnFacility=" & Session("MM_EmpUGNfacility
</tr>
<tr>
<td><strong><font size="-1"><a href="<%= MM_Logout %>"><img src="../images/bso.gif" width="108" height="18" border="0"></a></font></st
</tr>
</table>
<p><strong></strong></p> <strong></strong><strong><
<td width="88%" valign="top"> <table width="79%" border="0">
<tr>
<td bordercolor="#FFFFFF">
<form METHOD="POST" name="form1" action="<%=MM_editAction%>
<table width="715" border="0">
<tr>
<td width="124"><div align="right"><strong><fon
<td width="182"><input name="CartName" type="text" id="CartName" value="<%=(Cart_M.Fields.I
<td width="103"><div align="right"><strong><fon
<td width="212"><select name="ContainerNo" id="ContainerNo">
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<%
While (NOT Container_M.EOF)
%>
<option value="<%=(Container_M.Fie
<%
Container_M.MoveNext()
Wend
If (Container_M.CursorType > 0) Then
Container_M.MoveFirst
Else
Container_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon
<td><select name="CustId" id="CustId" onchange="custplantrefresh
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<%
While (NOT Cust_M.EOF)
%>
<option value="<%=(Cust_M.Fields.I
<%
Cust_M.MoveNext()
Wend
If (Cust_M.CursorType > 0) Then
Cust_M.MoveFirst
Else
Cust_M.Requery
End If
%>
</select></td>
<td><div align="right"><strong><fon
<td><select name="CustPlant" id="CustPlant">
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<%
While (NOT Cust_Plant_M.EOF)
%>
<option value="<%=(Cust_Plant_M.Fi
<%
Cust_Plant_M.MoveNext()
Wend
If (Cust_Plant_M.CursorType > 0) Then
Cust_Plant_M.MoveFirst
Else
Cust_Plant_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon
<td><select name="modelyear">
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<option value="1991" <%If (Not isNull((Cart_M.Fields.Item
<option value="1992" <%If (Not isNull((Cart_M.Fields.Item
<option value="1993" <%If (Not isNull((Cart_M.Fields.Item
<option value="1994" <%If (Not isNull((Cart_M.Fields.Item
<option value="1995" <%If (Not isNull((Cart_M.Fields.Item
<option value="1996" <%If (Not isNull((Cart_M.Fields.Item
<option value="1997" <%If (Not isNull((Cart_M.Fields.Item
<option value="1998" <%If (Not isNull((Cart_M.Fields.Item
<option value="1999" <%If (Not isNull((Cart_M.Fields.Item
<option value="2000" <%If (Not isNull((Cart_M.Fields.Item
<option value="2001" <%If (Not isNull((Cart_M.Fields.Item
<option value="2002" <%If (Not isNull((Cart_M.Fields.Item
<option value="2003" <%If (Not isNull((Cart_M.Fields.Item
<option value="2004" <%If (Not isNull((Cart_M.Fields.Item
<option value="2005" <%If (Not isNull((Cart_M.Fields.Item
<option value="2006" <%If (Not isNull((Cart_M.Fields.Item
<option value="2007" <%If (Not isNull((Cart_M.Fields.Item
<option value="2008" <%If (Not isNull((Cart_M.Fields.Item
<option value="2009" <%If (Not isNull((Cart_M.Fields.Item
<option value="2010" <%If (Not isNull((Cart_M.Fields.Item
<option value="2011" <%If (Not isNull((Cart_M.Fields.Item
<option value="2012" <%If (Not isNull((Cart_M.Fields.Item
<option value="2013" <%If (Not isNull((Cart_M.Fields.Item
<option value="2014" <%If (Not isNull((Cart_M.Fields.Item
<option value="2015" <%If (Not isNull((Cart_M.Fields.Item
<option value="2016" <%If (Not isNull((Cart_M.Fields.Item
<option value="2017" <%If (Not isNull((Cart_M.Fields.Item
<option value="2018" <%If (Not isNull((Cart_M.Fields.Item
<option value="2019" <%If (Not isNull((Cart_M.Fields.Item
<option value="2020" <%If (Not isNull((Cart_M.Fields.Item
</select></td>
<td><div align="right"><strong><fon
<td><input name="Model" type="text" id="Model" value="<%=(Cart_M.Fields.I
</tr>
<tr>
<td><div align="right"><strong><fon
<td><select name="UGNFacility" id="UGNFacility">
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<%
While (NOT UGN_Facility_M.EOF)
%>
<option value="<%=(UGN_Facility_M.
<%
UGN_Facility_M.MoveNext()
Wend
If (UGN_Facility_M.CursorType
UGN_Facility_M.MoveFirst
Else
UGN_Facility_M.Requery
End If
%>
</select></td>
<td><div align="right"><strong><fon
<td><select name="UGNDeptNo" id="UGNDeptNo">
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<%
While (NOT UGN_Dept_M.EOF)
%>
<option value="<%=(UGN_Dept_M.Fiel
<%
UGN_Dept_M.MoveNext()
Wend
If (UGN_Dept_M.CursorType > 0) Then
UGN_Dept_M.MoveFirst
Else
UGN_Dept_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon
<td><input name="RevisionDate" type="text" id="RevisionDate" onChange=CheckDate(this.fo
<td><div align="right"><strong><fon
<td><select name="EmpId" >
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<%
While (NOT Employee_M.EOF)
%>
<option value="<%=(Employee_M.Fiel
<%
Employee_M.MoveNext()
Wend
If (Employee_M.CursorType > 0) Then
Employee_M.MoveFirst
Else
Employee_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon
<td><select name="SingleMultiPartFlag"
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<option value="S" <%If (Not isNull((Cart_M.Fields.Item
<option value="M" <%If (Not isNull((Cart_M.Fields.Item
</select></td>
<td><div align="right"><strong><fon
<td><input name="GrossWeight" type="text" id="GrossWeight" onBlur="CheckGrossWeight(t
</tr>
<tr>
<td><div align="right"><strong><fon
<td><select name="IsPublished" id="IsPublished">
<option value="0" <%If (Not isNull((Cart_M.Fields.Item
<option value="1" selected <%If (Not isNull((Cart_M.Fields.Item
</select></td>
<td> </td>
<td><div align="right">
<input name="previewbutton" type="button" id="previewbutton" value="Preview" onclick="previewbuttonclic
<input type="submit" name="Submit" onClick="return savebuttonclick()" value="Save">
<input type="button" name="Button" onClick="return deletebuttonclick('Part Record to be Deleted?')" value="Delete">
</div></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="MM_recordId" value="<%= Cart_M.Fields.Item("CartNa
<input type="hidden" name="MM_QueryString" value="<%=Request.QueryStr
<%
Response.Write ("<script language='JavaScript'>chec
%>
</form>
</td>
</tr>
<tr>
<td bordercolor="#FFFFFF"><img
<map name="Map">
<area shape="rect" coords="15,2,95,23" href="Part_Detail_List.asp
<area shape="rect" coords="121,2,210,23" href="Instructions_List.as
</map>
</td>
</tr>
<tr>
<td bordercolor="#FFFFFF"><tab
<tr><td height="51"><form name="form2" method="POST" enctype="multipart/form-da
<p>File to Upload: <input name="file" type="file" onchange="checkfiletype(th
<input name="UploadButton" type="submit" style="margin-top:2" value="Upload" >
<input name="Submit2" type="hidden" onClick="MM_goToURL('paren
<%
Response.Write ("<script language='JavaScript'>chec
%>
</p>
<p>
<input type="image" border="0" name="imageField" src="file.asp?Cartname=<%=
</p>
</form></td>
</tr>
</table>
<p> </p></td>
</tr>
</table> <p> </p>
</td>
</tr>
</table>
<!-- InstanceEndEditable --><br>
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#CCCCCC">
<tr>
<td width="23%"> <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">©2003
UGN, Inc. </font></td>
<td width="77%" align="right"> </td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>
<%
Cart_M.Close()
Set Cart_M = Nothing
%>
<%
Cust_M.Close()
Set Cust_M = Nothing
%>
<%
Cust_Plant_M.Close()
Set Cust_Plant_M = Nothing
%>
<%
Employee_M.Close()
Set Employee_M = Nothing
%>
<%
Container_M.Close()
Set Container_M = Nothing
%>
<%
UGN_Facility_M.Close()
Set UGN_Facility_M = Nothing
%>
<%
UGN_Dept_M.Close()
Set UGN_Dept_M = Nothing
%>
------
Loader.asp
<%
' -- Loader.asp --
' -- version 1.5.2
' -- last updated 12/5/2002
'
' Faisal Khan
' faisal@stardeveloper.com
' www.stardeveloper.com
' Class for handling binary uploads
Class Loader
Private dict
Private Sub Class_Initialize
Set dict = Server.CreateObject("Scrip
End Sub
Private Sub Class_Terminate
If IsObject(intDict) Then
intDict.RemoveAll
Set intDict = Nothing
End If
If IsObject(dict) Then
dict.RemoveAll
Set dict = Nothing
End If
End Sub
Public Property Get Count
Count = dict.Count
End Property
Public Sub Initialize
If Request.TotalBytes > 0 Then
Dim binData
binData = Request.BinaryRead(Request
getData binData
End If
End Sub
Public Function getFileData(name)
If dict.Exists(name) Then
getFileData = dict(name).Item("Value")
Else
getFileData = ""
End If
End Function
Public Function getValue(name)
Dim gv
If dict.Exists(name) Then
gv = CStr(dict(name).Item("Valu
gv = Left(gv,Len(gv)-2)
getValue = gv
Else
getValue = ""
End If
End Function
Public Function saveToFile(name, path)
If dict.Exists(name) Then
Dim temp
temp = dict(name).Item("Value")
Dim fso
Set fso = Server.CreateObject("Scrip
Dim file
Set file = fso.CreateTextFile(path)
For tPoint = 1 to LenB(temp)
file.Write Chr(AscB(MidB(temp,tPoint,
Next
file.Close
saveToFile = True
Else
saveToFile = False
End If
End Function
Public Function getFileName(name)
If dict.Exists(name) Then
Dim temp, tempPos
temp = dict(name).Item("FileName"
tempPos = 1 + InStrRev(temp, "\")
getFileName = Mid(temp, tempPos)
Else
getFileName = ""
End If
End Function
Public Function getFilePath(name)
If dict.Exists(name) Then
Dim temp, tempPos
temp = dict(name).Item("FileName"
tempPos = InStrRev(temp, "\")
getFilePath = Mid(temp, 1, tempPos)
Else
getFilePath = ""
End If
End Function
Public Function getFilePathComplete(name)
If dict.Exists(name) Then
getFilePathComplete = dict(name).Item("FileName"
Else
getFilePathComplete = ""
End If
End Function
Public Function getFileSize(name)
If dict.Exists(name) Then
getFileSize = LenB(dict(name).Item("Valu
Else
getFileSize = 0
End If
End Function
Public Function getFileSizeTranslated(name
If dict.Exists(name) Then
temp = 1 + LenB(dict(name).Item("Valu
If Len(temp) <= 3 Then
getFileSizeTranslated = temp & " bytes"
ElseIf Len(temp) > 6 Then
temp = FormatNumber(((temp / 1024) / 1024), 2)
getFileSizeTranslated = temp & " megabytes"
Else
temp = FormatNumber((temp / 1024), 2)
getFileSizeTranslated = temp & " kilobytes"
End If
Else
getFileSizeTranslated = ""
End If
End Function
Public Function getContentType(name)
If dict.Exists(name) Then
getContentType = dict(name).Item("ContentTy
Else
getContentType = ""
End If
End Function
Private Sub getData(rawData)
Dim separator
separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)
Dim lenSeparator
lenSeparator = LenB(separator)
Dim currentPos
currentPos = 1
Dim inStrByte
inStrByte = 1
Dim value, mValue
Dim tempValue
tempValue = ""
While inStrByte > 0
inStrByte = InStrB(currentPos, rawData, separator)
mValue = inStrByte - currentPos
If mValue > 1 Then
value = MidB(rawData, currentPos, mValue)
Dim begPos, endPos, midValue, nValue
Dim intDict
Set intDict = Server.CreateObject("Scrip
begPos = 1 + InStrB(1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))
nValue = endPos
Dim nameN
nameN = MidB(value, begPos, endPos - begPos)
Dim nameValue, isValid
isValid = True
If InStrB(1, value, stringToByte("Content-Type
begPos = 1 + InStrB(endPos + 1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))
If endPos = 0 Then
endPos = begPos + 1
isValid = False
End If
midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "FileName", trim(byteToString(midValue
begPos = 14 + InStrB(endPos + 1, value, stringToByte("Content-Type
endPos = InStrB(begPos, value, ChrB(13))
midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "ContentType", trim(byteToString(midValue
begPos = endPos + 4
endPos = LenB(value)
nameValue = MidB(value, begPos, ((endPos - begPos) - 1))
Else
nameValue = trim(byteToString(MidB(val
End If
If isValid = True Then
intDict.Add "Value", nameValue
intDict.Add "Name", nameN
dict.Add byteToString(nameN), intDict
End If
End If
currentPos = lenSeparator + inStrByte
Wend
End Sub
End Class
Private Function stringToByte(toConv)
Dim tempChar
For i = 1 to Len(toConv)
tempChar = Mid(toConv, i, 1)
stringToByte = stringToByte & chrB(AscB(tempChar))
Next
End Function
Private Function byteToString(toConv)
For i = 1 to LenB(toConv)
byteToString = byteToString & chr(AscB(MidB(toConv,i,1))
Next
End Function
%>
----X----X----
ASKER
Now, what I am doing now. My modified code is as below.
Picture_Upload.asp
<%@LANGUAGE="VBSCRIPT"%>
<!-- #include file="UploadFile.asp" -->
<!-- #include file="../Connections/UGN_D B.asp" -->
<script language = "JavaScript">
function isDigit(theDigit)
{
var digitArray = new Array('0','1','2','3','4', '5','6','7 ','8','9') ,j;
for (j = 0; j < digitArray.length; j++)
{if (theDigit == digitArray[j])
return true
}
return false
}
/************************* ********** ********** ********** ********** ********/
/*Function name :isPositiveInteger(theStri ng) */
/*Usage of this function :test for an +ve integer */
/*Input parameter required:thedata=string for test whether is +ve integer*/
/*Return value :if is +ve integer,return true */
/* else return false */
/*function require :isDigit */
/************************* ********** ********** ********** ********** ********/
function isPositiveInteger(theStrin g)
{
var theData = new String(theString)
if (!isDigit(theData.charAt(0 )))
if (!(theData.charAt(0)== '+'))
return false
for (var i = 1; i < theData.length; i++)
if (!isDigit(theData.charAt(i )))
return false
return true
}
/************************* ********** ********** ********** ********** *****/
/*Function name :isDate(s,f) */
/*Usage of this function :To check s is a valid format */
/*Input parameter required:s=input string */
/* f=input string format */
/* =1,in mm/dd/yyyy format */
/* else in dd/mm/yyyy */
/*Return value :if is a valid date return 1 */
/* else return 0 */
/*Function required :isPositiveInteger() */
/************************* ********** ********** ********** ********** *****/
function isDate(s,f)
{
var a1=s.split("/");
var a2=s.split("-");
var e=true;
if ((a1.length!=3) && (a2.length!=3))
{
e=false;
}
else
{if (a1.length==3)
var na=a1;
if (a2.length==3)
var na=a2;
if (isPositiveInteger(na[0]) && isPositiveInteger(na[1]) && isPositiveInteger(na[2]))
{ if (f==1)
{var d=na[1],m=na[0];
}
else
{var d=na[0],m=na[1];
}
var y=na[2];
if (((e) && (y<1000)||y.length>4))
e=false
if (e)
{
v=new Date(m+"/"+d+"/"+y);
if (v.getMonth()!=m-1)
e=false;
}
}
else
{
e=false;
}
}
return e
}
function CheckDate(v)
{
var s=v.value;
if (!(s == ""))
{
if (!(isDate(s,1))) //dd/mm/yyyy format
{
alert("The inputed date value is not valid. Please Enter date in mm/dd/yyyy format");
document.form1.CartName.fo cus();
v.value = "";
v.focus();
return false;
}
}
}
function CheckGrossWeight(v)
{
var s=v.value;
if (isNaN(s))
{
alert("Please enter Gross Weight using numeric characters only! Your entered value '" + s + "' is not numeric.");
document.form1.CartName.fo cus();
v.value = "";
v.focus();
return false;
}
}
function CheckQtyPacked(v)
{
var s=v.value;
if (isNaN(s))
{
alert("Please enter Qty Packed using numeric characters only! Your entered value '" + s + "' is not numeric.");
//document.form2.qtypacked .focus();
v.value = "";
v.focus();
return false;
}
}
function deletebuttonclick(msg)
{
//confirm(msg);
var x=window.confirm(msg)
if (x)
{
location.href = "Cart_Delete.asp?" + document.form1.MM_QueryStr ing.value;
return true;
}
else
{
//alert("Not Agree");
}
}
function uploadbuttonclick(uploaded file)
{
alert("uploadedfile = " + uploadedfile.value );
newWindow = window.open();
newWindow.location.href = "Picture_Upload_Action.asp ?" + "<%=Request.QueryString%>" + "&uploadedfile=" + uploadedfile.value;
}
function previewbuttonclick()
{
newWindow = window.open();
newWindow.location.href = "rpt_packaging_layout.asp? CartName=" + document.form1.CartName.va lue + "&CustId=" + document.form1.CustId.valu e + "&CustPlant=" + document.form1.CustPlant.v alue;
}
function checkfiletype(thevalue)
{
var regx = new RegExp(".jpg$","i")
var regx2 = new RegExp(".bmp$","i")
if (regx.test(thevalue))
{
return true;
}
else if (regx2.test(thevalue))
{
return true;
}
else
{
alert("Please Select only .jpg or .bmp fles")
document.form2.Submit2.foc us;
document.form2.attach1.val ue = "";
thevalue.focus;
return false;
}
}
function filetypecheck()
{
var regx = new RegExp(".jpg$","i")
var regx2 = new RegExp(".bmp$","i")
//if (regx.test(document.form2. file.value ))
if (regx.test(document.form2. attach1.va lue))
{
return true;
}
else if (regx2.test(document.form2 .attach1.v alue))
{
return true;
}
else
{
alert("Please Select only .jpg or .bmp fles")
return false;
}
}
function checkfields()
{
var num = document.form1.elements.le ngth
var localpcks002 = "<%=session("PCKS002")%>"; //NEW CONTAINER Entry
var ugnDeptNo = "<%=session("MM_UGNDeptNo" )%>"; // Dept # 6 - Packaging
var ugnUserId = "<%=session("MM_UserId")%> "; //EmpId of User
//alert("localpcks001 = " + localpcks001 + ", ugnDeptNo = " + ugnDeptNo + ", ugnUserId = " + ugnUserId );
for (var i=0; i<num;i++)
{
if ( localpcks002 == "E" ) //Packaging Dept user will have EDIT rights
{
document.form1.elements[i] .disabled = false;
}
else //// Select/ReadOnly. None of above condition satisfied then disable all fields.
{
document.form1.elements[i] .disabled = true;
}
}
} // end of function checkfields()
function checkfieldsform2()
{
var num = document.form2.elements.le ngth
var localpcks002 = "<%=session("PCKS002")%>"; //NEW CONTAINER Entry
var ugnDeptNo = "<%=session("MM_UGNDeptNo" )%>"; // Dept # 6 - Packaging
var ugnUserId = "<%=session("MM_UserId")%> "; //EmpId of User
//alert("localpcks001 = " + localpcks001 + ", ugnDeptNo = " + ugnDeptNo + ", ugnUserId = " + ugnUserId );
for (var i=0; i<num;i++)
{
if ( localpcks002 == "E" ) //Packaging Dept user will have EDIT rights
{
document.form2.elements[i] .disabled = false;
}
else //// Select/ReadOnly. None of above condition satisfied then disable all fields.
{
document.form2.elements[i] .disabled = true;
}
}
} // end of function checkfieldsform2()
</script>
<%
' *** Logout the current user.
MM_Logout = CStr(Request.ServerVariabl es("URL")) & "?MM_Logoutnow=1"
If (CStr(Request("MM_Logoutno w")) = "1") Then
Session.Contents.Remove("M M_Username ")
Session.Contents.Remove("M M_UserAuth orization" )
MM_logoutRedirectPage = "../ugndb_login.asp"
' redirect with URL parameters (remove the "MM_Logoutnow" query param).
if (MM_logoutRedirectPage = "") Then MM_logoutRedirectPage = CStr(Request.ServerVariabl es("URL"))
If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_newQS = "?"
For Each Item In Request.QueryString
If (Item <> "MM_Logoutnow") Then
If (Len(MM_newQS) > 1) Then MM_newQS = MM_newQS & "&"
MM_newQS = MM_newQS & Item & "=" & Server.URLencode(Request.Q ueryString (Item))
End If
Next
if (Len(MM_newQS) > 1) Then MM_logoutRedirectPage = MM_logoutRedirectPage & MM_newQS
End If
Response.Redirect(MM_logou tRedirectP age)
End If
%>
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariabl es("SCRIPT _NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request. QueryStrin g)
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables
If (CStr(Request("MM_update") ) = "form1" And CStr(Request("MM_recordId" )) <> "") Then
MM_editConnection = MM_UGN_DB_STRING
MM_editTable = "dbo.Cart_M"
MM_editColumn = "CartName"
MM_recordId = "'" + Request.Form("MM_recordId" ) + "'"
MM_editRedirectUrl = "Picture_Upload.asp"
MM_fieldsStr = "CartName|value|ContainerN o|value|Cu stId|value |CustPlant |value|mod elyear|val ue|Model|v alue|UGNFa cility|val ue|UGNDept No|value|R evisionDat e|value|Em pId|value| SingleMult iPartFlag| value|Gros sWeight|va lue|IsPubl ished|valu e"
MM_columnsStr = "CartName|',none,''|Contai nerNo|',no ne,''|Cust Id|none,no ne,NULL|Cu stPlant|', none,''|Mo delYear|no ne,none,NU LL|Model|' ,none,''|U GNFacility |none,none ,NULL|UGND eptNo|none ,none,NULL |RevisionD ate|',none ,NULL|EmpI d|none,non e,NULL|Sin gleMultiPa rtFlag|',n one,''|Gro ssWeight|n one,none,N ULL|IsPubl ished|none ,none,NULL "
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_field s(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Update Record: construct a sql update statement and execute it
If (CStr(Request("MM_update") ) <> "" And CStr(Request("MM_recordId" )) <> "") Then
' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1)," ,")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","'' ") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject("ADODB .Command")
MM_editCmd.ActiveConnectio n = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnectio n.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editR edirectUrl )
End If
End If
End If
%>
<%
Dim Cart_M__vCartName
Cart_M__vCartName = "%"
If (Request.QueryString("Cart Name") <> "") Then
Cart_M__vCartName = Request.QueryString("CartN ame")
End If
%>
<%
Dim Cart_M__vCustId
Cart_M__vCustId = "0"
If (Request.QueryString("Cust Id") <> "") Then
Cart_M__vCustId = Request.QueryString("CustI d")
End If
%>
<%
Dim Cart_M__VCustPlant
Cart_M__VCustPlant = "%"
If (Request.QueryString("Cust Plant") <> "") Then
Cart_M__VCustPlant = Request.QueryString("CustP lant")
End If
%>
<%
Dim Cart_M
Dim Cart_M_numRows
Set Cart_M = Server.CreateObject("ADODB .Recordset ")
Cart_M.ActiveConnection = MM_UGN_DB_STRING
Cart_M.Source = "SELECT CartName, ContainerNo, RevisionDate, CustId, CustPlant, Model, ModelYear, EmpId, GrossWeight, IsPublished, UGNFacility, UGNDeptNo, SingleMultiPartFlag FROM Cart_M WHERE Cart_M.CartName = '" + Replace(Cart_M__vCartName, "'", "''") + "' and Cart_M.CustId = '" + Replace(Cart_M__vCustId, "'", "''") + "' and Cart_M.CustPlant = '" + Replace(Cart_M__VCustPlant , "'", "''") + "' ORDER BY Cart_M.CartName"
'response.write("Cart_M.So urce = " & Cart_M.Source)
'response.end
Cart_M.CursorType = 0
Cart_M.CursorLocation = 2
Cart_M.LockType = 1
Cart_M.Open()
Cart_M_numRows = 0
%>
<%
Dim Cust_M
Dim Cust_M_numRows
Set Cust_M = Server.CreateObject("ADODB .Recordset ")
Cust_M.ActiveConnection = MM_UGN_DB_STRING
Cust_M.Source = "SELECT Cust_M.CustId, Cust_M.CustName FROM Cust_M ORDER BY CustName "
Cust_M.CursorType = 0
Cust_M.CursorLocation = 2
Cust_M.LockType = 1
Cust_M.Open()
Cust_M_numRows = 0
%>
<%
Dim Cust_Plant_M
Dim Cust_Plant_M_numRows
Set Cust_Plant_M = Server.CreateObject("ADODB .Recordset ")
Cust_Plant_M.ActiveConnect ion = MM_UGN_DB_STRING
Cust_Plant_M.Source = "SELECT Cust_Plant_M.CustPlant, Cust_M.CustName + '-> ' + Cust_Plant_M.CustPlant as CustPlantName FROM Cust_M, Cust_Plant_M Where Cust_M.CustId = Cust_Plant_M.CustId ORDER BY Cust_M.CustName, Cust_Plant_M.CustPlant "
Cust_Plant_M.CursorType = 0
Cust_Plant_M.CursorLocatio n = 2
Cust_Plant_M.LockType = 1
Cust_Plant_M.Open()
Cust_Plant_M_numRows = 0
%>
<%
Dim Employee_M
Dim Employee_M_numRows
Set Employee_M = Server.CreateObject("ADODB .Recordset ")
Employee_M.ActiveConnectio n = MM_UGN_DB_STRING
Employee_M.Source = "SELECT EmpId, EmplastName + ', ' + EmpFirstName AS EmpName FROM Employee_M WHERE EmpStatus='Working' ORDER BY EmplastName +' '+ EmpFirstName"
Employee_M.CursorType = 0
Employee_M.CursorLocation = 2
Employee_M.LockType = 1
Employee_M.Open()
Employee_M_numRows = 0
%>
<%
Dim Container_M
Dim Container_M_numRows
Set Container_M = Server.CreateObject("ADODB .Recordset ")
Container_M.ActiveConnecti on = MM_UGN_DB_STRING
Container_M.Source = "SELECT Container_M.ContainerNo FROM Container_M ORDER BY Container_M.ContainerNo"
Container_M.CursorType = 0
Container_M.CursorLocation = 2
Container_M.LockType = 1
Container_M.Open()
Container_M_numRows = 0
%>
<%
Dim UGN_Facility_M
Dim UGN_Facility_M_numRows
Set UGN_Facility_M = Server.CreateObject("ADODB .Recordset ")
UGN_Facility_M.ActiveConne ction = MM_UGN_DB_STRING
UGN_Facility_M.Source = "Select UGNFacility, UGNFacilityName from UGN_Facility_M Where UGNFacility < 15 Order By UGNFacility"
UGN_Facility_M.CursorType = 0
UGN_Facility_M.CursorLocat ion = 2
UGN_Facility_M.LockType = 1
UGN_Facility_M.Open()
UGN_Facility_M_numRows = 0
%>
<%
Dim UGN_Dept_M
Dim UGN_Dept_M_numRows
Set UGN_Dept_M = Server.CreateObject("ADODB .Recordset ")
UGN_Dept_M.ActiveConnectio n = MM_UGN_DB_STRING
UGN_Dept_M.Source = "Select UGNDeptNo, UGNDeptName from UGN_Dept_M Where UGNDeptNo > 0 Order By UGNDeptName"
UGN_Dept_M.CursorType = 0
UGN_Dept_M.CursorLocation = 2
UGN_Dept_M.LockType = 1
UGN_Dept_M.Open()
UGN_Dept_M_numRows = 0
%>
<html><!-- InstanceBegin template="file:///C|/Inetp ub/wwwroot /Main Menu/Templates/temp_red.dw t" codeOutsideHTMLIsLocked="f alse" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Picture Upload</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" -->
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='" +args[i+1] +"'");
}
//-->
</script>
<!-- InstanceEndEditable -->
<script language="JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_pre loadImages .arguments ; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
<!--
function TJK_noWayBack(){// http://www.MadCoWWWebDesign.com - Thierry Koblentz
history.go(1);
}
TJK_noWayBack();
//-->
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="TJK_noWayBack()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2" bgcolor="#666666"> <img src="http://ugndb/onTrack/images/luxury.png" name="image" width="125" height="50">
</td>
<td width="100%" bgcolor="#CCCCCC"><font color="#de192b" size="1" face="Verdana, Arial, Helvetica, sans-serif">
<strong>UGN, Inc.</strong></font></td>
</tr>
<tr>
<td align="left" valign="bottom" bgcolor="#CCCCCC"><strong> <font size="-1">Your
logged in as <font color="#de192b" size="1" face="Verdana, Arial, Helvetica, sans-serif">
<strong><%=Session("MM_Use rName")%>< /strong></ font> .</font></strong></td>
</tr>
</table>
<!-- InstanceBeginEditable name="Body" -->
<table width="100%" border="0" cellspacing="2" cellpadding="4" align="center">
<tr bgcolor="#333333">
<td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td nowrap bgcolor="#de192b"><font color="#CCCCCC" size="1"><b>Quick
Links</b></font></td>
</tr>
</table>
</td>
<td width="88%">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td bgcolor="#de192b"> &n bsp;</td>
<td width="100%"> <font color="#CCCCCC"> <b>Create/Modify Packaging
Layout</b></font></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="123%" border="0" cellspacing="4" cellpadding="4" align="center">
<tr>
<td width="12%" valign="top">
<table>
<tr>
<td height="21"><a href="Packaging_Module_Men u.asp"><im g src="../images/pkgm.gif" width="108" height="19" border="0"></a></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><hr>
</td>
</tr>
<tr>
<td><strong><a href="http://ugndb/ugnmainmenu/Main_Menu.asp?<%="UgnFacility=" & Session("MM_EmpUGNfacility ") %>"><img src="../images/bugn.gif" width="108" height="29" border="0"></a></strong></ td>
</tr>
<tr>
<td><strong><font size="-1"><a href="<%= MM_Logout %>"><img src="../images/bso.gif" width="108" height="18" border="0"></a></font></st rong></td>
</tr>
</table>
<p><strong></strong></p> <strong></strong><strong>< /strong><s trong></st rong><stro ng></stron g><strong> <font color="#000000"> </fo nt></stron g></td>
<td width="88%" valign="top"> <table width="79%" border="0">
<tr>
<td bordercolor="#FFFFFF">
<form METHOD="POST" name="form1" action="<%=MM_editAction%> ">
<table width="715" border="0">
<tr>
<td width="124"><div align="right"><strong><fon t size="-1"><font color="#990000">*</font>Pa rt Number :</font></strong></div></t d>
<td width="182"><input name="CartName" type="text" id="CartName" value="<%=(Cart_M.Fields.I tem("CartN ame").Valu e)%>"></td >
<td width="103"><div align="right"><strong><fon t size="-1">Container No: </font></strong></div></td >
<td width="212"><select name="ContainerNo" id="ContainerNo">
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("Containe rNo").Valu e))) Then If ("" = CStr((Cart_M.Fields.Item(" ContainerN o").Value) )) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<%
While (NOT Container_M.EOF)
%>
<option value="<%=(Container_M.Fie lds.Item(" ContainerN o").Value) %>" <%If (Not isNull((Cart_M.Fields.Item ("Containe rNo").Valu e))) Then If (CStr(Container_M.Fields.I tem("Conta inerNo").V alue) = CStr((Cart_M.Fields.Item(" ContainerN o").Value) )) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(Container_M.Fields.It em("Contai nerNo").Va lue)%></op tion>
<%
Container_M.MoveNext()
Wend
If (Container_M.CursorType > 0) Then
Container_M.MoveFirst
Else
Container_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon t size="-1"><font color="#990000">*</font>Cu stomer: </font></strong></div></td >
<td><select name="CustId" id="CustId" onchange="custplantrefresh ()">
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("CustId") .Value))) Then If ("" = CStr((Cart_M.Fields.Item(" CustId").V alue))) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<%
While (NOT Cust_M.EOF)
%>
<option value="<%=(Cust_M.Fields.I tem("CustI d").Value) %>" <%If (Not isNull((Cart_M.Fields.Item ("CustId") .Value))) Then If (CStr(Cust_M.Fields.Item(" CustId").V alue) = CStr((Cart_M.Fields.Item(" CustId").V alue))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(Cust_M.Fields.Item("C ustName"). Value)%></ option>
<%
Cust_M.MoveNext()
Wend
If (Cust_M.CursorType > 0) Then
Cust_M.MoveFirst
Else
Cust_M.Requery
End If
%>
</select></td>
<td><div align="right"><strong><fon t size="-1"><font color="#990000">*</font>Cu stomer Plant:</font></strong></di v></td>
<td><select name="CustPlant" id="CustPlant">
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("CustPlan t").Value) )) Then If ("" = CStr((Cart_M.Fields.Item(" CustPlant" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<%
While (NOT Cust_Plant_M.EOF)
%>
<option value="<%=(Cust_Plant_M.Fi elds.Item( "CustPlant ").Value)% >" <%If (Not isNull((Cart_M.Fields.Item ("CustPlan t").Value) )) Then If (CStr(Cust_Plant_M.Fields. Item("Cust Plant").Va lue) = CStr((Cart_M.Fields.Item(" CustPlant" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(Cust_Plant_M.Fields.I tem("CustP lantName") .Value)%>< /option>
<%
Cust_Plant_M.MoveNext()
Wend
If (Cust_Plant_M.CursorType > 0) Then
Cust_Plant_M.MoveFirst
Else
Cust_Plant_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon t size="-1">Model Year:</font></strong></div ></td>
<td><select name="modelyear">
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<option value="1991" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1991" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1991< /option>
<option value="1992" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1992" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1992< /option>
<option value="1993" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1993" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1993< /option>
<option value="1994" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1994" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1994< /option>
<option value="1995" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1995" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1995< /option>
<option value="1996" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1996" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1996< /option>
<option value="1997" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1997" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1997< /option>
<option value="1998" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1998" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1998< /option>
<option value="1999" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("1999" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>1999< /option>
<option value="2000" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2000" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2000< /option>
<option value="2001" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2001" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2001< /option>
<option value="2002" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2002" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2002< /option>
<option value="2003" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2003" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2003< /option>
<option value="2004" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2004" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2004< /option>
<option value="2005" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2005" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2005< /option>
<option value="2006" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2006" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2006< /option>
<option value="2007" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2007" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2007< /option>
<option value="2008" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2008" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2008< /option>
<option value="2009" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2009" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2009< /option>
<option value="2010" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2010" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2010< /option>
<option value="2011" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2011" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2011< /option>
<option value="2012" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2012" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2012< /option>
<option value="2013" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2013" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2013< /option>
<option value="2014" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2014" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2014< /option>
<option value="2015" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2015" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2015< /option>
<option value="2016" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2016" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2016< /option>
<option value="2017" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2017" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2017< /option>
<option value="2018" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2018" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2018< /option>
<option value="2019" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2019" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2019< /option>
<option value="2020" <%If (Not isNull((Cart_M.Fields.Item ("ModelYea r").Value) )) Then If ("2020" = CStr((Cart_M.Fields.Item(" ModelYear" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>2020< /option>
</select></td>
<td><div align="right"><strong><fon t size="-1">Model:</font></s trong></di v></td>
<td><input name="Model" type="text" id="Model" value="<%=(Cart_M.Fields.I tem("Model ").Value)% >"></td>
</tr>
<tr>
<td><div align="right"><strong><fon t size="-1">UGN Facility:</font></strong>< /div></td>
<td><select name="UGNFacility" id="UGNFacility">
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("UGNFacil ity").Valu e))) Then If ("" = CStr((Cart_M.Fields.Item(" UGNFacilit y").Value) )) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<%
While (NOT UGN_Facility_M.EOF)
%>
<option value="<%=(UGN_Facility_M. Fields.Ite m("UGNFaci lity").Val ue)%>" <%If (Not isNull((Cart_M.Fields.Item ("UGNFacil ity").Valu e))) Then If (CStr(UGN_Facility_M.Field s.Item("UG NFacility" ).Value) = CStr((Cart_M.Fields.Item(" UGNFacilit y").Value) )) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(UGN_Facility_M.Fields .Item("UGN FacilityNa me").Value )%></optio n>
<%
UGN_Facility_M.MoveNext()
Wend
If (UGN_Facility_M.CursorType > 0) Then
UGN_Facility_M.MoveFirst
Else
UGN_Facility_M.Requery
End If
%>
</select></td>
<td><div align="right"><strong><fon t size="-1">UGN Department: </font></strong></div></td >
<td><select name="UGNDeptNo" id="UGNDeptNo">
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("UGNDeptN o").Value) )) Then If ("" = CStr((Cart_M.Fields.Item(" UGNDeptNo" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<%
While (NOT UGN_Dept_M.EOF)
%>
<option value="<%=(UGN_Dept_M.Fiel ds.Item("U GNDeptNo") .Value)%>" <%If (Not isNull((Cart_M.Fields.Item ("UGNDeptN o").Value) )) Then If (CStr(UGN_Dept_M.Fields.It em("UGNDep tNo").Valu e) = CStr((Cart_M.Fields.Item(" UGNDeptNo" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(UGN_Dept_M.Fields.Ite m("UGNDept Name").Val ue)%></opt ion>
<%
UGN_Dept_M.MoveNext()
Wend
If (UGN_Dept_M.CursorType > 0) Then
UGN_Dept_M.MoveFirst
Else
UGN_Dept_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon t size="-1">Revision Date:</font></strong></div ></td>
<td><input name="RevisionDate" type="text" id="RevisionDate" onChange=CheckDate(this.fo rm.Revisio nDate) value="<%=(Cart_M.Fields.I tem("Revis ionDate"). Value)%>" ></td>
<td><div align="right"><strong><fon t size="-1">Employee:</font> </strong>< /div></td>
<td><select name="EmpId" >
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("EmpId"). Value))) Then If ("" = CStr((Cart_M.Fields.Item(" EmpId").Va lue))) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<%
While (NOT Employee_M.EOF)
%>
<option value="<%=(Employee_M.Fiel ds.Item("E mpId").Val ue)%>" <%If (Not isNull((Cart_M.Fields.Item ("EmpId"). Value))) Then If (CStr(Employee_M.Fields.It em("EmpId" ).Value) = CStr((Cart_M.Fields.Item(" EmpId").Va lue))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(Employee_M.Fields.Ite m("EmpName ").Value)% ></option>
<%
Employee_M.MoveNext()
Wend
If (Employee_M.CursorType > 0) Then
Employee_M.MoveFirst
Else
Employee_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon t size="-1">Single/Multiple Part :</font></strong></div></t d>
<td><select name="SingleMultiPartFlag" id="SingleMultiPartFlag">
<option value="" <%If (Not isNull((Cart_M.Fields.Item ("SingleMu ltiPartFla g").Value) )) Then If ("" = CStr((Cart_M.Fields.Item(" SingleMult iPartFlag" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>></opt ion>
<option value="S" <%If (Not isNull((Cart_M.Fields.Item ("SingleMu ltiPartFla g").Value) )) Then If ("S" = CStr((Cart_M.Fields.Item(" SingleMult iPartFlag" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>Singl e</option>
<option value="M" <%If (Not isNull((Cart_M.Fields.Item ("SingleMu ltiPartFla g").Value) )) Then If ("M" = CStr((Cart_M.Fields.Item(" SingleMult iPartFlag" ).Value))) Then Response.Write("SELECTED") : Response.Write("")%>>Multi ple</optio n>
</select></td>
<td><div align="right"><strong><fon t size="-1">Gross Weight: </font></strong></div></td >
<td><input name="GrossWeight" type="text" id="GrossWeight" onBlur="CheckGrossWeight(t his.form.G rossWeight )" value="<%=(Cart_M.Fields.I tem("Gross Weight").V alue)%>" maxlength="6"></td>
</tr>
<tr>
<td><div align="right"><strong><fon t size="-1">Is Published:</font></strong> </div></td >
<td><select name="IsPublished" id="IsPublished">
<option value="0" <%If (Not isNull((Cart_M.Fields.Item ("IsPublis hed").Valu e))) Then If ("0" = CStr((Cart_M.Fields.Item(" IsPublishe d").Value) )) Then Response.Write("SELECTED") : Response.Write("")%>>No</o ption>
<option value="1" selected <%If (Not isNull((Cart_M.Fields.Item ("IsPublis hed").Valu e))) Then If ("1" = CStr((Cart_M.Fields.Item(" IsPublishe d").Value) )) Then Response.Write("SELECTED") : Response.Write("")%>>Yes</ option>
</select></td>
<td> </td>
<td><div align="right">
<input name="previewbutton" type="button" id="previewbutton" value="Preview" onclick="previewbuttonclic k()">
<input type="submit" name="Submit" onClick="return savebuttonclick()" value="Save">
<input type="button" name="Button" onClick="return deletebuttonclick('Part Record to be Deleted?')" value="Delete">
</div></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="MM_recordId" value="<%= Cart_M.Fields.Item("CartNa me").Value %>">
<input type="hidden" name="MM_QueryString" value="<%=Request.QueryStr ing%>">
<%
Response.Write ("<script language='JavaScript'>chec kfields(); </script>" )
%>
</form>
</td>
</tr>
<tr>
<td bordercolor="#FFFFFF"><img src="images/picture.png" width="598" height="27" border="0" usemap="#Map">
<map name="Map">
<area shape="rect" coords="15,2,95,23" href="Part_Detail_List.asp ?CartName= <%=Cart_M( "CartName" )%>&CustId =<%=Cart_M ("CustId") %>&CustPla nt=<%=Cart _M("CustPl ant")%>">
<area shape="rect" coords="121,2,210,23" href="Instructions_List.as p?CartName =<%=Cart_M ("CartName ")%>&CustI d=<%=Cart_ M("CustId" )%>&CustPl ant=<%=Car t_M("CustP lant")%>">
</map>
</td>
</tr>
<tr>
<td bordercolor="#FFFFFF"><tab le width="96%" border="1">
<tr><td height="51">
<%
'Delete files existing in "\\DB_Server\UGN_DB\TEST_M ainMenu\rf c\reports\ rtmp\" for current RFC record each time the user enters this screen
'Dim objFSO, objFile, objFolder
'Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
'Set objFolder = objFSO.GetFolder(server.ma ppath("./r eports/rtm p"))
'For Each objFile in objFolder.Files
' If ( Left(objFile.Name,InStr(ob jFile.Name ,"_")-1) = Request.QueryString("RFQNo ") ) Then
' objFSO.DeleteFile(Server.M apPath("./ reports/rt mp/" & objFile.Name))
' End If
'Next
' ************************** ********** ********** ******
' Change the value of the variable below to the pathname
' of a directory with write permissions, for example "C:\Inetpub\wwwroot"
Dim uploadsDirVar
''''''''''uploadsDirVar = "D:\ugn_db\TEST_MainMenu\r fc\reports \rtmp"
uploadsDirVar = "C:\"
' ************************** ********** ********** ******
' Note: this file uploadTester.asp is just an example to demonstrate
' the capabilities of the freeASPUpload.asp class. There are no plans
' to add any new features to uploadTester.asp itself. Feel free to add
' your own code. If you are building a content management system, you
' may also want to consider this script: http://www.webfilebrowser.com/
function OutputForm()
%>
<br>
<form name="form2" method="POST" enctype="multipart/form-da ta" onSubmit="return filetypecheck()" action="Picture_Upload.asp ?CartName= <%=Request .QueryStri ng("CartNa me")%>&Cus tId=<%=Req uest.Query String("Cu stId")%>&C ustPlant=< %=Request. QueryStrin g("CustPla nt")%>">
<p>File to Upload: <input name="attach1" type="file" onchange="checkfiletype(th is.value)" size=80><br> <br>
<input name="UploadButton" type="submit" style="margin-top:2" value="Upload" >
<input name="Submit2" type="hidden" onClick="MM_goToURL('paren t','RFC_Up date.asp?R FQNo=<%=Re quest.Quer yString("R FQNo")%>&r f=<%=Reque st.QuerySt ring("rf") %>&orig=<% =Request.Q ueryString ("orig")%> &qe=<%=Req uest.Query String("qe ")%>&co=<% =Request.Q ueryString ("co")%>&c d=<%=Reque st.QuerySt ring("cd") %>&sa=<%=R equest.Que ryString(" sa")%>');r eturn document.MM_returnValue" value="Cancel">
<%
Response.Write ("<script language='JavaScript'>chec kfieldsfor m2();</scr ipt>")
%>
</p>
<p>
<input type="image" border="0" name="imageField" src="file.asp?Cartname=<%= Request.Qu eryString( "Cartname" )%>&CustId =<%=Reques t.QueryStr ing("CustI d")%>&Cust Plant=<%=R equest.Que ryString(" CustPlant" )%>" width="600" height="400" >
</p>
</form>
<br>
<%
end function
function TestEnvironment()
Dim fso, fileName, testFile, streamTest
TestEnvironment = ""
Set fso = Server.CreateObject("Scrip ting.FileS ystemObjec t")
if not fso.FolderExists(uploadsDi rVar) then
TestEnvironment = "<B>Folder " & uploadsDirVar & " does not exist.</B><br>The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions."
exit function
end if
fileName = uploadsDirVar & "\test.txt"
on error resume next
Set testFile = fso.CreateTextFile(fileNam e, true)
If Err.Number<>0 then
TestEnvironment = "<B>Folder " & uploadsDirVar & " does not have write permissions.</B><br>The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions."
exit function
end if
Err.Clear
testFile.Close
fso.DeleteFile(fileName)
If Err.Number<>0 then
TestEnvironment = "<B>Folder " & uploadsDirVar & " does not have delete permissions</B>, although it does have write permissions.<br>Change the permissions for IUSR_<I>computername</I> on this folder."
exit function
end if
Err.Clear
Set streamTest = Server.CreateObject("ADODB .Stream")
If Err.Number<>0 then
TestEnvironment = "<B>The ADODB object <I>Stream</I> is not available in your server.</B><br>Check the Requirements page for information about upgrading your ADODB libraries."
exit function
end if
Set streamTest = Nothing
end function
function SaveFiles
Dim Upload, fileName, fileSize, ks, i, fileKey
Set Upload = New FreeASPUpload
Upload.Save(uploadsDirVar)
'createing File system Object
Set fso = Server.CreateObject("Scrip ting.FileS ystemObjec t")
'Delete older files
fileName = uploadsDirVar & "drawing.jpg"
if (fso.FileExists(FileName) = TRUE) then
fso.DeleteFile(FileName)
End if
fileName = uploadsDirVar & "drawing.bmp"
if (fso.FileExists(FileName) = TRUE) then
fso.DeleteFile(FileName)
End if
SaveFiles = ""
ks = Upload.UploadedFiles.keys
if (UBound(ks) <> -1) then
SaveFiles = "<B>Files uploaded:</B> "
for each fileKey in Upload.UploadedFiles.keys
If SaveFiles = "" Then
SaveFiles = Upload.UploadedFiles(fileK ey).FileNa me & " (" & Upload.UploadedFiles(fileK ey).Length & "B) " & chr(10)
'SaveFiles = "drawing.jpg" & " (" & Upload.UploadedFiles(fileK ey).Length & "B) " & chr(10)
Else
SaveFiles = SaveFiles & "; " & Upload.UploadedFiles(fileK ey).FileNa me & " (" & Upload.UploadedFiles(fileK ey).Length & "B) " & chr(10)
'SaveFiles = SaveFiles & "; " & "drawing.jpg" & " (" & Upload.UploadedFiles(fileK ey).Length & "B) " & chr(10)
End If
If ( LCase(Right(Upload.Uploade dFiles(fil eKey).File Name,3)) = "jpg" ) Then
fileName = uploadsDirVar & Upload.UploadedFiles(fileK ey).FileNa me
fileName2 = "C:\drawing.jpg"
fso.CopyFile fileName, fileName2, True
if (fso.FileExists(FileName) = TRUE) then
fso.DeleteFile(FileName)
end if
ElseIf ( lCase(Right(Upload.Uploade dFiles(fil eKey).File Name,3)) = "bmp" ) Then
fileName = uploadsDirVar & Upload.UploadedFiles(fileK ey).FileNa me
fileName2 = "C:\drawing.bmp"
fso.CopyFile fileName, fileName2, True
if (fso.FileExists(FileName) = TRUE) then
fso.DeleteFile(FileName)
end if
'Converting C:\drawing.bmp to C:\drawing.jpg
Set Executor = Server.CreateObject("ASPEx ec.Execute ")
Executor.Application = "D:\UGN_DB\Test_MainMenu\P ackaging\v bJPGc3.exe "
Executor.ShowWindow = True
strResult = Executor.ExecuteWinApp
'After converting to C:\drawing.jpg. Deleting the C:\drawing.bmp
if (fso.FileExists(FileName2) = TRUE) then
fso.DeleteFile(FileName2)
end if
End If
Next
else
SaveFiles = "The file name specified in the upload form does not correspond to a valid file in the system."
end if
end function
%>
<%
Dim diagnostics
if Request.ServerVariables("R EQUEST_MET HOD") <> "POST" then
diagnostics = TestEnvironment()
if diagnostics<>"" then
response.write "<div style=""margin-left:10; margin-top:30; margin-right:30; margin-bottom:20;"">"
response.write diagnostics
response.write "<p>After you correct this problem, reload the page."
response.write "</div>"
else
response.write "<div style=""margin-left:10"">"
OutputForm()
response.write "</div>"
end if
else
response.write "<div style=""margin-left:10"">"
OutputForm()
response.write SaveFiles()
response.write "<br><br></div>"
response.redirect("insert_ from_disk. asp?CartNa me=" & Request.QueryString("CartN ame") & "&CustId=" & Request.QueryString("CustI d") & "&CustPlant=" & Request.QueryString("CustP lant") )
end if
%>
</td>
</tr>
</table>
<p> </p></td>
</tr>
</table> <p> </p>
</td>
</tr>
</table>
<!-- InstanceEndEditable --><br>
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#CCCCCC">
<tr>
<td width="23%"> <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">©2003
UGN, Inc. </font></td>
<td width="77%" align="right"> </td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>
<%
Cart_M.Close()
Set Cart_M = Nothing
%>
<%
Cust_M.Close()
Set Cust_M = Nothing
%>
<%
Cust_Plant_M.Close()
Set Cust_Plant_M = Nothing
%>
<%
Employee_M.Close()
Set Employee_M = Nothing
%>
<%
Container_M.Close()
Set Container_M = Nothing
%>
<%
UGN_Facility_M.Close()
Set UGN_Facility_M = Nothing
%>
<%
UGN_Dept_M.Close()
Set UGN_Dept_M = Nothing
%>
-------------------------- --
<!--#include file="Loader.asp"-->
<%
Response.Buffer = True
' load object
Dim load
Set load = new Loader
' calling initialize method
load.initialize
' File binary data
Dim fileData
fileData = load.getFileData("c:\drawi ng.jpg")
' File name
Dim fileName
fileName = LCase(load.getFileName("c: \drawing.j pg"))
' File path
Dim filePath
filePath = load.getFilePath("c:\drawi ng.jpg")
' File path complete
Dim filePathComplete
filePathComplete = load.getFilePathComplete(" c:\drawing .jpg")
' File size
Dim fileSize
fileSize = load.getFileSize("c:\drawi ng.jpg")
' File size translated
Dim fileSizeTranslated
fileSizeTranslated = load.getFileSizeTranslated ("c:\drawi ng.jpg")
' Content Type
Dim contentType
contentType = load.getContentType("c:\dr awing.jpg" )
' No. of Form elements
Dim countElements
countElements = load.Count
'' Value of text input field "fname"
'Dim fnameInput
' fnameInput = load.getValue("fname")
'' Value of text input field "lname"
'Dim lnameInput
' lnameInput = load.getValue("lname")
'' Value of text input field "profession"
'Dim profession
' profession = load.getValue("profession" )
' destroying load object
Set load = Nothing
%>
<html>
<head>
<title>Inserts Images into Database</title>
<style>
body, input, td { font-family:verdana,arial; font-size:10pt; }
</style>
</head>
<body>
<p align="center">
<b>Inserting Binary Data into Database</b><br>
<a href="show.asp">To see inserted data click here</a>
</p>
<%
CartName = Request.QueryString("CartN ame")
CustId = Request.QueryString("CustI d")
CustPlant = Request.QueryString("CustP lant")
'UploadedFile = Request.form("File")
%>
<table width="700" border="1" align="center">
<tr>
<td>File Name</td><td><%= fileName %></td>
</tr><tr>
<td>File Path</td><td><%= filePath %></td>
</tr><tr>
<td>File Size</td><td><%= fileSize %></td>
<td>File Path Complete</td><td><%= filePathComplete %></td>
</tr><tr>
</tr><tr>
<td>File Size Translated</td><td><%= fileSizeTranslated %></td>
</tr><tr>
<td>Content Type</td><td><%= contentType %></td>
</tr><tr>
<td>No. of Form Elements</td><td><%= countElements %></td>
</tr>
</table><br><br>
<p style="padding-left:220;">
<%= fileName %> data received ...<br>
<%
Response.write("Hello CartName = " & CartName & ", CustId = " & CustId & ", CustPlant = " & CustPlant & ", UploadedFile = " & UploadedFile)
Response.end
%>
<%
' Checking to make sure if file was uploaded
If fileSize > 0 Then
' Connection string
Dim connStr
set connStr = Server.CreateObject("ADODB .Connectio n")
'connStr = "Provider=Microsoft.Jet.OL EDB.4.0; Data Source=" & Server.MapPath("FileDB.mdb ")
connStr.open = "dsn=Test_UGN_DB_DSN;uid=s a;pwd=arih ant;"
' Recordset object
Dim rs
Set rs = Server.CreateObject("ADODB .Recordset ")
'rs.Open "Files", connStr, 2, 2
sqltext = "select cartname, contenttypepicture3, Picture3Size, Picture3 from Cart_M where CartName = '" & CartName & "' and Cart_M.CustId = " & CustId & " and Cart_M.CustPlant = '" & CustPlant & "'"
rs.Open sqltext, connStr, 2, 4
'response.write("sqltext = " & sqltext & ", fileSize = " & fileSize & ", contentType " & contentType )
'response.end
' Adding data
'rs.AddNew
rs("Picture3Size") = fileSize
rs("Picture3").AppendChunk fileData
rs("contenttypepicture3") = contentType
rs.UpdateBatch
rs.Close
Set rs = Nothing
Response.Write "<font color=""green"">File was successfully uploaded...</font>"
Else
Response.Write "<font color=""brown"">No file was selected for uploading...</font>"
End If
If Err.number <> 0 Then
Response.Write "<br><font color=""red"">Something went wrong...</font>"
End If
response.redirect("Picture _Upload.as p?CartName =" & CartName & "&CustId=" & CustId & "&CustPlant=" & CustPlant )
%>
</p>
<br>
</body>
</html>
-------------------------- ----
UploadFile.asp
<%
' For examples, documentation, and your own free copy, go to:
' http://www.freeaspupload.net
' Note: You can copy and use this script for free and you can make changes
' to the code, but you cannot remove the above comment.
Class FreeASPUpload
Public UploadedFiles
Public FormElements
Private VarArrayBinRequest
Private StreamRequest
Private uploadedYet
Private Sub Class_Initialize()
Set UploadedFiles = Server.CreateObject("Scrip ting.Dicti onary")
Set FormElements = Server.CreateObject("Scrip ting.Dicti onary")
Set StreamRequest = Server.CreateObject("ADODB .Stream")
StreamRequest.Type = 1 'adTypeBinary
StreamRequest.Open
uploadedYet = false
End Sub
Private Sub Class_Terminate()
If IsObject(UploadedFiles) Then
UploadedFiles.RemoveAll()
Set UploadedFiles = Nothing
End If
If IsObject(FormElements) Then
FormElements.RemoveAll()
Set FormElements = Nothing
End If
StreamRequest.Close
Set StreamRequest = Nothing
End Sub
Public Property Get Form(sIndex)
Form = ""
If FormElements.Exists(LCase( sIndex)) Then Form = FormElements.Item(LCase(sI ndex))
End Property
Public Property Get Files()
Files = UploadedFiles.Items
End Property
'Calls Upload to extract the data from the binary request and then saves the uploaded files
Public Sub Save(path)
Dim streamFile, fileItem
if Right(path, 1) <> "\" then path = path & "\"
if not uploadedYet then Upload
For Each fileItem In UploadedFiles.Items
Set streamFile = Server.CreateObject("ADODB .Stream")
streamFile.Type = 1
streamFile.Open
StreamRequest.Position=fil eItem.Star t
StreamRequest.CopyTo streamFile, fileItem.Length
streamFile.SaveToFile path & fileItem.FileName, 2
streamFile.close
Set streamFile = Nothing
fileItem.Path = path & fileItem.FileName
Next
End Sub
Public Function SaveBinRequest(path) ' For debugging purposes
StreamRequest.SaveToFile path & "\debugStream.bin", 2
End Function
Public Sub DumpData() 'only works if files are plain text
Dim i, aKeys, f
response.write "Form Items:<br>"
aKeys = FormElements.Keys
For i = 0 To FormElements.Count -1 ' Iterate the array
response.write aKeys(i) & " = " & FormElements.Item(aKeys(i) ) & "<BR>"
Next
response.write "Uploaded Files:<br>"
For Each f In UploadedFiles.Items
response.write "Name: " & f.FileName & "<br>"
response.write "Type: " & f.ContentType & "<br>"
response.write "Start: " & f.Start & "<br>"
response.write "Size: " & f.Length & "<br>"
Next
End Sub
Private Sub Upload()
Dim nCurPos, nDataBoundPos, nLastSepPos
Dim nPosFile, nPosBound
Dim sFieldName, osPathSep, auxStr
'RFC1867 Tokens
Dim vDataSep
Dim tNewLine, tDoubleQuotes, tTerm, tFilename, tName, tContentDisp, tContentType
tNewLine = Byte2String(Chr(13))
tDoubleQuotes = Byte2String(Chr(34))
tTerm = Byte2String("--")
tFilename = Byte2String("filename=""")
tName = Byte2String("name=""")
tContentDisp = Byte2String("Content-Dispo sition")
tContentType = Byte2String("Content-Type: ")
uploadedYet = true
VarArrayBinRequest = Request.BinaryRead(Request .TotalByte s)
nCurPos = FindToken(tNewLine,1) 'Note: nCurPos is 1-based (and so is InstrB, MidB, etc)
If nCurPos <= 1 Then Exit Sub
'vDataSep is a separator like -------------------------- ---2176313 8716045
vDataSep = MidB(VarArrayBinRequest, 1, nCurPos-1)
'Start of current separator
nDataBoundPos = 1
'Beginning of last line
nLastSepPos = FindToken(vDataSep & tTerm, 1)
Do Until nDataBoundPos = nLastSepPos
nCurPos = SkipToken(tContentDisp, nDataBoundPos)
nCurPos = SkipToken(tName, nCurPos)
sFieldName = ExtractField(tDoubleQuotes , nCurPos)
nPosFile = FindToken(tFilename, nCurPos)
nPosBound = FindToken(vDataSep, nCurPos)
If nPosFile <> 0 And nPosFile < nPosBound Then
Dim oUploadFile
Set oUploadFile = New UploadedFile
nCurPos = SkipToken(tFilename, nCurPos)
auxStr = ExtractField(tDoubleQuotes , nCurPos)
' We are interested only in the name of the file, not the whole path
' Path separator is \ in windows, / in UNIX
' While IE seems to put the whole pathname in the stream, Mozilla seem to
' only put the actual file name, so UNIX paths may be rare. But not impossible.
osPathSep = "\"
if InStr(auxStr, osPathSep) = 0 then osPathSep = "/"
oUploadFile.FileName = Right(auxStr, Len(auxStr)-InStrRev(auxSt r, osPathSep))
if (Len(oUploadFile.FileName) > 0) then 'File field not left empty
nCurPos = SkipToken(tContentType, nCurPos)
auxStr = ExtractField(tNewLine, nCurPos)
' NN on UNIX puts things like this in the streaa:
' ?? python py type=?? python application/x-python
oUploadFile.ContentType = Right(auxStr, Len(auxStr)-InStrRev(auxSt r, " "))
nCurPos = FindToken(tNewLine, nCurPos) + 4 'skip empty line
oUploadFile.Start = nCurPos-1
oUploadFile.Length = FindToken(vDataSep, nCurPos) - 2 - nCurPos
If oUploadFile.Length > 0 Then UploadedFiles.Add LCase(sFieldName), oUploadFile
End If
Else
Dim nEndOfData
nCurPos = FindToken(tNewLine, nCurPos) + 4 'skip empty line
nEndOfData = FindToken(vDataSep, nCurPos) - 2
If Not FormElements.Exists(LCase( sFieldName )) Then FormElements.Add LCase(sFieldName), String2Byte(MidB(VarArrayB inRequest, nCurPos, nEndOfData-nCurPos))
End If
'Advance to next separator
nDataBoundPos = FindToken(vDataSep, nCurPos)
Loop
StreamRequest.Write(VarArr ayBinReque st)
End Sub
Private Function SkipToken(sToken, nStart)
SkipToken = InstrB(nStart, VarArrayBinRequest, sToken)
If SkipToken = 0 then
Response.write "Error in parsing uploaded binary request."
Response.End
end if
SkipToken = SkipToken + LenB(sToken)
End Function
Private Function FindToken(sToken, nStart)
FindToken = InstrB(nStart, VarArrayBinRequest, sToken)
End Function
Private Function ExtractField(sToken, nStart)
Dim nEnd
nEnd = InstrB(nStart, VarArrayBinRequest, sToken)
If nEnd = 0 then
Response.write "Error in parsing uploaded binary request."
Response.End
end if
ExtractField = String2Byte(MidB(VarArrayB inRequest, nStart, nEnd-nStart))
End Function
'String to byte string conversion
Private Function Byte2String(sString)
Dim i
For i = 1 to Len(sString)
Byte2String = Byte2String & ChrB(AscB(Mid(sString,i,1) ))
Next
End Function
'Byte string to string conversion
Private Function String2Byte(bsString)
Dim i
String2Byte =""
For i = 1 to LenB(bsString)
String2Byte = String2Byte & Chr(AscB(MidB(bsString,i,1 )))
Next
End Function
End Class
Class UploadedFile
Public ContentType
Public Start
Public Length
Public Path
Private nameOfFile
' Need to remove characters that are valid in UNIX, but not in Windows
Public Property Let FileName(fN)
nameOfFile = fN
nameOfFile = SubstNoReg(nameOfFile, "\", "_")
nameOfFile = SubstNoReg(nameOfFile, "/", "_")
nameOfFile = SubstNoReg(nameOfFile, ":", "_")
nameOfFile = SubstNoReg(nameOfFile, "*", "_")
nameOfFile = SubstNoReg(nameOfFile, "?", "_")
nameOfFile = SubstNoReg(nameOfFile, """", "_")
nameOfFile = SubstNoReg(nameOfFile, "<", "_")
nameOfFile = SubstNoReg(nameOfFile, ">", "_")
nameOfFile = SubstNoReg(nameOfFile, "|", "_")
End Property
Public Property Get FileName()
FileName = Request.QueryString("RFQNo ") & "_" & nameOfFile
End Property
'Public Property Get FileN()ame
End Class
' Does not depend on RegEx, which is not available on older VBScript
' Is not recursive, which means it will not run out of stack space
Function SubstNoReg(initialStr, oldStr, newStr)
Dim currentPos, oldStrPos, skip
If IsNull(initialStr) Or Len(initialStr) = 0 Then
SubstNoReg = ""
ElseIf IsNull(oldStr) Or Len(oldStr) = 0 Then
SubstNoReg = initialStr
Else
If IsNull(newStr) Then newStr = ""
currentPos = 1
oldStrPos = 0
SubstNoReg = ""
skip = Len(oldStr)
Do While currentPos <= Len(initialStr)
oldStrPos = InStr(currentPos, initialStr, oldStr)
If oldStrPos = 0 Then
SubstNoReg = SubstNoReg & Mid(initialStr, currentPos, Len(initialStr) - currentPos + 1)
currentPos = Len(initialStr) + 1
Else
SubstNoReg = SubstNoReg & Mid(initialStr, currentPos, oldStrPos - currentPos) & newStr
currentPos = oldStrPos + skip
End If
Loop
End If
End Function
%>
----
I want to do something in insert_from_disk.asp . So, it can pick up data from Server Hard disk. c:\drawing.jpg is server location.
fileData = load.getFileData("c:\drawi ng.jpg")
Thanks for your patience...............
Picture_Upload.asp
<%@LANGUAGE="VBSCRIPT"%>
<!-- #include file="UploadFile.asp" -->
<!-- #include file="../Connections/UGN_D
<script language = "JavaScript">
function isDigit(theDigit)
{
var digitArray = new Array('0','1','2','3','4',
for (j = 0; j < digitArray.length; j++)
{if (theDigit == digitArray[j])
return true
}
return false
}
/*************************
/*Function name :isPositiveInteger(theStri
/*Usage of this function :test for an +ve integer */
/*Input parameter required:thedata=string for test whether is +ve integer*/
/*Return value :if is +ve integer,return true */
/* else return false */
/*function require :isDigit */
/*************************
function isPositiveInteger(theStrin
{
var theData = new String(theString)
if (!isDigit(theData.charAt(0
if (!(theData.charAt(0)== '+'))
return false
for (var i = 1; i < theData.length; i++)
if (!isDigit(theData.charAt(i
return false
return true
}
/*************************
/*Function name :isDate(s,f) */
/*Usage of this function :To check s is a valid format */
/*Input parameter required:s=input string */
/* f=input string format */
/* =1,in mm/dd/yyyy format */
/* else in dd/mm/yyyy */
/*Return value :if is a valid date return 1 */
/* else return 0 */
/*Function required :isPositiveInteger() */
/*************************
function isDate(s,f)
{
var a1=s.split("/");
var a2=s.split("-");
var e=true;
if ((a1.length!=3) && (a2.length!=3))
{
e=false;
}
else
{if (a1.length==3)
var na=a1;
if (a2.length==3)
var na=a2;
if (isPositiveInteger(na[0]) && isPositiveInteger(na[1]) && isPositiveInteger(na[2]))
{ if (f==1)
{var d=na[1],m=na[0];
}
else
{var d=na[0],m=na[1];
}
var y=na[2];
if (((e) && (y<1000)||y.length>4))
e=false
if (e)
{
v=new Date(m+"/"+d+"/"+y);
if (v.getMonth()!=m-1)
e=false;
}
}
else
{
e=false;
}
}
return e
}
function CheckDate(v)
{
var s=v.value;
if (!(s == ""))
{
if (!(isDate(s,1))) //dd/mm/yyyy format
{
alert("The inputed date value is not valid. Please Enter date in mm/dd/yyyy format");
document.form1.CartName.fo
v.value = "";
v.focus();
return false;
}
}
}
function CheckGrossWeight(v)
{
var s=v.value;
if (isNaN(s))
{
alert("Please enter Gross Weight using numeric characters only! Your entered value '" + s + "' is not numeric.");
document.form1.CartName.fo
v.value = "";
v.focus();
return false;
}
}
function CheckQtyPacked(v)
{
var s=v.value;
if (isNaN(s))
{
alert("Please enter Qty Packed using numeric characters only! Your entered value '" + s + "' is not numeric.");
//document.form2.qtypacked
v.value = "";
v.focus();
return false;
}
}
function deletebuttonclick(msg)
{
//confirm(msg);
var x=window.confirm(msg)
if (x)
{
location.href = "Cart_Delete.asp?" + document.form1.MM_QueryStr
return true;
}
else
{
//alert("Not Agree");
}
}
function uploadbuttonclick(uploaded
{
alert("uploadedfile = " + uploadedfile.value );
newWindow = window.open();
newWindow.location.href = "Picture_Upload_Action.asp
}
function previewbuttonclick()
{
newWindow = window.open();
newWindow.location.href = "rpt_packaging_layout.asp?
}
function checkfiletype(thevalue)
{
var regx = new RegExp(".jpg$","i")
var regx2 = new RegExp(".bmp$","i")
if (regx.test(thevalue))
{
return true;
}
else if (regx2.test(thevalue))
{
return true;
}
else
{
alert("Please Select only .jpg or .bmp fles")
document.form2.Submit2.foc
document.form2.attach1.val
thevalue.focus;
return false;
}
}
function filetypecheck()
{
var regx = new RegExp(".jpg$","i")
var regx2 = new RegExp(".bmp$","i")
//if (regx.test(document.form2.
if (regx.test(document.form2.
{
return true;
}
else if (regx2.test(document.form2
{
return true;
}
else
{
alert("Please Select only .jpg or .bmp fles")
return false;
}
}
function checkfields()
{
var num = document.form1.elements.le
var localpcks002 = "<%=session("PCKS002")%>";
var ugnDeptNo = "<%=session("MM_UGNDeptNo"
var ugnUserId = "<%=session("MM_UserId")%>
//alert("localpcks001 = " + localpcks001 + ", ugnDeptNo = " + ugnDeptNo + ", ugnUserId = " + ugnUserId );
for (var i=0; i<num;i++)
{
if ( localpcks002 == "E" ) //Packaging Dept user will have EDIT rights
{
document.form1.elements[i]
}
else //// Select/ReadOnly. None of above condition satisfied then disable all fields.
{
document.form1.elements[i]
}
}
} // end of function checkfields()
function checkfieldsform2()
{
var num = document.form2.elements.le
var localpcks002 = "<%=session("PCKS002")%>";
var ugnDeptNo = "<%=session("MM_UGNDeptNo"
var ugnUserId = "<%=session("MM_UserId")%>
//alert("localpcks001 = " + localpcks001 + ", ugnDeptNo = " + ugnDeptNo + ", ugnUserId = " + ugnUserId );
for (var i=0; i<num;i++)
{
if ( localpcks002 == "E" ) //Packaging Dept user will have EDIT rights
{
document.form2.elements[i]
}
else //// Select/ReadOnly. None of above condition satisfied then disable all fields.
{
document.form2.elements[i]
}
}
} // end of function checkfieldsform2()
</script>
<%
' *** Logout the current user.
MM_Logout = CStr(Request.ServerVariabl
If (CStr(Request("MM_Logoutno
Session.Contents.Remove("M
Session.Contents.Remove("M
MM_logoutRedirectPage = "../ugndb_login.asp"
' redirect with URL parameters (remove the "MM_Logoutnow" query param).
if (MM_logoutRedirectPage = "") Then MM_logoutRedirectPage = CStr(Request.ServerVariabl
If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_newQS = "?"
For Each Item In Request.QueryString
If (Item <> "MM_Logoutnow") Then
If (Len(MM_newQS) > 1) Then MM_newQS = MM_newQS & "&"
MM_newQS = MM_newQS & Item & "=" & Server.URLencode(Request.Q
End If
Next
if (Len(MM_newQS) > 1) Then MM_logoutRedirectPage = MM_logoutRedirectPage & MM_newQS
End If
Response.Redirect(MM_logou
End If
%>
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariabl
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables
If (CStr(Request("MM_update")
MM_editConnection = MM_UGN_DB_STRING
MM_editTable = "dbo.Cart_M"
MM_editColumn = "CartName"
MM_recordId = "'" + Request.Form("MM_recordId"
MM_editRedirectUrl = "Picture_Upload.asp"
MM_fieldsStr = "CartName|value|ContainerN
MM_columnsStr = "CartName|',none,''|Contai
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_field
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Update Record: construct a sql update statement and execute it
If (CStr(Request("MM_update")
' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),"
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject("ADODB
MM_editCmd.ActiveConnectio
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnectio
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editR
End If
End If
End If
%>
<%
Dim Cart_M__vCartName
Cart_M__vCartName = "%"
If (Request.QueryString("Cart
Cart_M__vCartName = Request.QueryString("CartN
End If
%>
<%
Dim Cart_M__vCustId
Cart_M__vCustId = "0"
If (Request.QueryString("Cust
Cart_M__vCustId = Request.QueryString("CustI
End If
%>
<%
Dim Cart_M__VCustPlant
Cart_M__VCustPlant = "%"
If (Request.QueryString("Cust
Cart_M__VCustPlant = Request.QueryString("CustP
End If
%>
<%
Dim Cart_M
Dim Cart_M_numRows
Set Cart_M = Server.CreateObject("ADODB
Cart_M.ActiveConnection = MM_UGN_DB_STRING
Cart_M.Source = "SELECT CartName, ContainerNo, RevisionDate, CustId, CustPlant, Model, ModelYear, EmpId, GrossWeight, IsPublished, UGNFacility, UGNDeptNo, SingleMultiPartFlag FROM Cart_M WHERE Cart_M.CartName = '" + Replace(Cart_M__vCartName,
'response.write("Cart_M.So
'response.end
Cart_M.CursorType = 0
Cart_M.CursorLocation = 2
Cart_M.LockType = 1
Cart_M.Open()
Cart_M_numRows = 0
%>
<%
Dim Cust_M
Dim Cust_M_numRows
Set Cust_M = Server.CreateObject("ADODB
Cust_M.ActiveConnection = MM_UGN_DB_STRING
Cust_M.Source = "SELECT Cust_M.CustId, Cust_M.CustName FROM Cust_M ORDER BY CustName "
Cust_M.CursorType = 0
Cust_M.CursorLocation = 2
Cust_M.LockType = 1
Cust_M.Open()
Cust_M_numRows = 0
%>
<%
Dim Cust_Plant_M
Dim Cust_Plant_M_numRows
Set Cust_Plant_M = Server.CreateObject("ADODB
Cust_Plant_M.ActiveConnect
Cust_Plant_M.Source = "SELECT Cust_Plant_M.CustPlant, Cust_M.CustName + '-> ' + Cust_Plant_M.CustPlant as CustPlantName FROM Cust_M, Cust_Plant_M Where Cust_M.CustId = Cust_Plant_M.CustId ORDER BY Cust_M.CustName, Cust_Plant_M.CustPlant "
Cust_Plant_M.CursorType = 0
Cust_Plant_M.CursorLocatio
Cust_Plant_M.LockType = 1
Cust_Plant_M.Open()
Cust_Plant_M_numRows = 0
%>
<%
Dim Employee_M
Dim Employee_M_numRows
Set Employee_M = Server.CreateObject("ADODB
Employee_M.ActiveConnectio
Employee_M.Source = "SELECT EmpId, EmplastName + ', ' + EmpFirstName AS EmpName FROM Employee_M WHERE EmpStatus='Working' ORDER BY EmplastName +' '+ EmpFirstName"
Employee_M.CursorType = 0
Employee_M.CursorLocation = 2
Employee_M.LockType = 1
Employee_M.Open()
Employee_M_numRows = 0
%>
<%
Dim Container_M
Dim Container_M_numRows
Set Container_M = Server.CreateObject("ADODB
Container_M.ActiveConnecti
Container_M.Source = "SELECT Container_M.ContainerNo FROM Container_M ORDER BY Container_M.ContainerNo"
Container_M.CursorType = 0
Container_M.CursorLocation
Container_M.LockType = 1
Container_M.Open()
Container_M_numRows = 0
%>
<%
Dim UGN_Facility_M
Dim UGN_Facility_M_numRows
Set UGN_Facility_M = Server.CreateObject("ADODB
UGN_Facility_M.ActiveConne
UGN_Facility_M.Source = "Select UGNFacility, UGNFacilityName from UGN_Facility_M Where UGNFacility < 15 Order By UGNFacility"
UGN_Facility_M.CursorType = 0
UGN_Facility_M.CursorLocat
UGN_Facility_M.LockType = 1
UGN_Facility_M.Open()
UGN_Facility_M_numRows = 0
%>
<%
Dim UGN_Dept_M
Dim UGN_Dept_M_numRows
Set UGN_Dept_M = Server.CreateObject("ADODB
UGN_Dept_M.ActiveConnectio
UGN_Dept_M.Source = "Select UGNDeptNo, UGNDeptName from UGN_Dept_M Where UGNDeptNo > 0 Order By UGNDeptName"
UGN_Dept_M.CursorType = 0
UGN_Dept_M.CursorLocation = 2
UGN_Dept_M.LockType = 1
UGN_Dept_M.Open()
UGN_Dept_M_numRows = 0
%>
<html><!-- InstanceBegin template="file:///C|/Inetp
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Picture Upload</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" -->
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"
}
//-->
</script>
<!-- InstanceEndEditable -->
<script language="JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_pre
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
<!--
function TJK_noWayBack(){// http://www.MadCoWWWebDesign.com - Thierry Koblentz
history.go(1);
}
TJK_noWayBack();
//-->
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="TJK_noWayBack()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2" bgcolor="#666666"> <img src="http://ugndb/onTrack/images/luxury.png" name="image" width="125" height="50">
</td>
<td width="100%" bgcolor="#CCCCCC"><font color="#de192b" size="1" face="Verdana, Arial, Helvetica, sans-serif">
<strong>UGN, Inc.</strong></font></td>
</tr>
<tr>
<td align="left" valign="bottom" bgcolor="#CCCCCC"><strong>
logged in as <font color="#de192b" size="1" face="Verdana, Arial, Helvetica, sans-serif">
<strong><%=Session("MM_Use
</tr>
</table>
<!-- InstanceBeginEditable name="Body" -->
<table width="100%" border="0" cellspacing="2" cellpadding="4" align="center">
<tr bgcolor="#333333">
<td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td nowrap bgcolor="#de192b"><font color="#CCCCCC" size="1"><b>Quick
Links</b></font></td>
</tr>
</table>
</td>
<td width="88%">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td bgcolor="#de192b"> &n
<td width="100%"> <font color="#CCCCCC"> <b>Create/Modify Packaging
Layout</b></font></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="123%" border="0" cellspacing="4" cellpadding="4" align="center">
<tr>
<td width="12%" valign="top">
<table>
<tr>
<td height="21"><a href="Packaging_Module_Men
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><hr>
</td>
</tr>
<tr>
<td><strong><a href="http://ugndb/ugnmainmenu/Main_Menu.asp?<%="UgnFacility=" & Session("MM_EmpUGNfacility
</tr>
<tr>
<td><strong><font size="-1"><a href="<%= MM_Logout %>"><img src="../images/bso.gif" width="108" height="18" border="0"></a></font></st
</tr>
</table>
<p><strong></strong></p> <strong></strong><strong><
<td width="88%" valign="top"> <table width="79%" border="0">
<tr>
<td bordercolor="#FFFFFF">
<form METHOD="POST" name="form1" action="<%=MM_editAction%>
<table width="715" border="0">
<tr>
<td width="124"><div align="right"><strong><fon
<td width="182"><input name="CartName" type="text" id="CartName" value="<%=(Cart_M.Fields.I
<td width="103"><div align="right"><strong><fon
<td width="212"><select name="ContainerNo" id="ContainerNo">
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<%
While (NOT Container_M.EOF)
%>
<option value="<%=(Container_M.Fie
<%
Container_M.MoveNext()
Wend
If (Container_M.CursorType > 0) Then
Container_M.MoveFirst
Else
Container_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon
<td><select name="CustId" id="CustId" onchange="custplantrefresh
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<%
While (NOT Cust_M.EOF)
%>
<option value="<%=(Cust_M.Fields.I
<%
Cust_M.MoveNext()
Wend
If (Cust_M.CursorType > 0) Then
Cust_M.MoveFirst
Else
Cust_M.Requery
End If
%>
</select></td>
<td><div align="right"><strong><fon
<td><select name="CustPlant" id="CustPlant">
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<%
While (NOT Cust_Plant_M.EOF)
%>
<option value="<%=(Cust_Plant_M.Fi
<%
Cust_Plant_M.MoveNext()
Wend
If (Cust_Plant_M.CursorType > 0) Then
Cust_Plant_M.MoveFirst
Else
Cust_Plant_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon
<td><select name="modelyear">
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<option value="1991" <%If (Not isNull((Cart_M.Fields.Item
<option value="1992" <%If (Not isNull((Cart_M.Fields.Item
<option value="1993" <%If (Not isNull((Cart_M.Fields.Item
<option value="1994" <%If (Not isNull((Cart_M.Fields.Item
<option value="1995" <%If (Not isNull((Cart_M.Fields.Item
<option value="1996" <%If (Not isNull((Cart_M.Fields.Item
<option value="1997" <%If (Not isNull((Cart_M.Fields.Item
<option value="1998" <%If (Not isNull((Cart_M.Fields.Item
<option value="1999" <%If (Not isNull((Cart_M.Fields.Item
<option value="2000" <%If (Not isNull((Cart_M.Fields.Item
<option value="2001" <%If (Not isNull((Cart_M.Fields.Item
<option value="2002" <%If (Not isNull((Cart_M.Fields.Item
<option value="2003" <%If (Not isNull((Cart_M.Fields.Item
<option value="2004" <%If (Not isNull((Cart_M.Fields.Item
<option value="2005" <%If (Not isNull((Cart_M.Fields.Item
<option value="2006" <%If (Not isNull((Cart_M.Fields.Item
<option value="2007" <%If (Not isNull((Cart_M.Fields.Item
<option value="2008" <%If (Not isNull((Cart_M.Fields.Item
<option value="2009" <%If (Not isNull((Cart_M.Fields.Item
<option value="2010" <%If (Not isNull((Cart_M.Fields.Item
<option value="2011" <%If (Not isNull((Cart_M.Fields.Item
<option value="2012" <%If (Not isNull((Cart_M.Fields.Item
<option value="2013" <%If (Not isNull((Cart_M.Fields.Item
<option value="2014" <%If (Not isNull((Cart_M.Fields.Item
<option value="2015" <%If (Not isNull((Cart_M.Fields.Item
<option value="2016" <%If (Not isNull((Cart_M.Fields.Item
<option value="2017" <%If (Not isNull((Cart_M.Fields.Item
<option value="2018" <%If (Not isNull((Cart_M.Fields.Item
<option value="2019" <%If (Not isNull((Cart_M.Fields.Item
<option value="2020" <%If (Not isNull((Cart_M.Fields.Item
</select></td>
<td><div align="right"><strong><fon
<td><input name="Model" type="text" id="Model" value="<%=(Cart_M.Fields.I
</tr>
<tr>
<td><div align="right"><strong><fon
<td><select name="UGNFacility" id="UGNFacility">
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<%
While (NOT UGN_Facility_M.EOF)
%>
<option value="<%=(UGN_Facility_M.
<%
UGN_Facility_M.MoveNext()
Wend
If (UGN_Facility_M.CursorType
UGN_Facility_M.MoveFirst
Else
UGN_Facility_M.Requery
End If
%>
</select></td>
<td><div align="right"><strong><fon
<td><select name="UGNDeptNo" id="UGNDeptNo">
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<%
While (NOT UGN_Dept_M.EOF)
%>
<option value="<%=(UGN_Dept_M.Fiel
<%
UGN_Dept_M.MoveNext()
Wend
If (UGN_Dept_M.CursorType > 0) Then
UGN_Dept_M.MoveFirst
Else
UGN_Dept_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon
<td><input name="RevisionDate" type="text" id="RevisionDate" onChange=CheckDate(this.fo
<td><div align="right"><strong><fon
<td><select name="EmpId" >
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<%
While (NOT Employee_M.EOF)
%>
<option value="<%=(Employee_M.Fiel
<%
Employee_M.MoveNext()
Wend
If (Employee_M.CursorType > 0) Then
Employee_M.MoveFirst
Else
Employee_M.Requery
End If
%>
</select></td>
</tr>
<tr>
<td><div align="right"><strong><fon
<td><select name="SingleMultiPartFlag"
<option value="" <%If (Not isNull((Cart_M.Fields.Item
<option value="S" <%If (Not isNull((Cart_M.Fields.Item
<option value="M" <%If (Not isNull((Cart_M.Fields.Item
</select></td>
<td><div align="right"><strong><fon
<td><input name="GrossWeight" type="text" id="GrossWeight" onBlur="CheckGrossWeight(t
</tr>
<tr>
<td><div align="right"><strong><fon
<td><select name="IsPublished" id="IsPublished">
<option value="0" <%If (Not isNull((Cart_M.Fields.Item
<option value="1" selected <%If (Not isNull((Cart_M.Fields.Item
</select></td>
<td> </td>
<td><div align="right">
<input name="previewbutton" type="button" id="previewbutton" value="Preview" onclick="previewbuttonclic
<input type="submit" name="Submit" onClick="return savebuttonclick()" value="Save">
<input type="button" name="Button" onClick="return deletebuttonclick('Part Record to be Deleted?')" value="Delete">
</div></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="MM_recordId" value="<%= Cart_M.Fields.Item("CartNa
<input type="hidden" name="MM_QueryString" value="<%=Request.QueryStr
<%
Response.Write ("<script language='JavaScript'>chec
%>
</form>
</td>
</tr>
<tr>
<td bordercolor="#FFFFFF"><img
<map name="Map">
<area shape="rect" coords="15,2,95,23" href="Part_Detail_List.asp
<area shape="rect" coords="121,2,210,23" href="Instructions_List.as
</map>
</td>
</tr>
<tr>
<td bordercolor="#FFFFFF"><tab
<tr><td height="51">
<%
'Delete files existing in "\\DB_Server\UGN_DB\TEST_M
'Dim objFSO, objFile, objFolder
'Set objFSO = CreateObject("Scripting.Fi
'Set objFolder = objFSO.GetFolder(server.ma
'For Each objFile in objFolder.Files
' If ( Left(objFile.Name,InStr(ob
' objFSO.DeleteFile(Server.M
' End If
'Next
' **************************
' Change the value of the variable below to the pathname
' of a directory with write permissions, for example "C:\Inetpub\wwwroot"
Dim uploadsDirVar
''''''''''uploadsDirVar = "D:\ugn_db\TEST_MainMenu\r
uploadsDirVar = "C:\"
' **************************
' Note: this file uploadTester.asp is just an example to demonstrate
' the capabilities of the freeASPUpload.asp class. There are no plans
' to add any new features to uploadTester.asp itself. Feel free to add
' your own code. If you are building a content management system, you
' may also want to consider this script: http://www.webfilebrowser.com/
function OutputForm()
%>
<br>
<form name="form2" method="POST" enctype="multipart/form-da
<p>File to Upload: <input name="attach1" type="file" onchange="checkfiletype(th
<input name="UploadButton" type="submit" style="margin-top:2" value="Upload" >
<input name="Submit2" type="hidden" onClick="MM_goToURL('paren
<%
Response.Write ("<script language='JavaScript'>chec
%>
</p>
<p>
<input type="image" border="0" name="imageField" src="file.asp?Cartname=<%=
</p>
</form>
<br>
<%
end function
function TestEnvironment()
Dim fso, fileName, testFile, streamTest
TestEnvironment = ""
Set fso = Server.CreateObject("Scrip
if not fso.FolderExists(uploadsDi
TestEnvironment = "<B>Folder " & uploadsDirVar & " does not exist.</B><br>The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions."
exit function
end if
fileName = uploadsDirVar & "\test.txt"
on error resume next
Set testFile = fso.CreateTextFile(fileNam
If Err.Number<>0 then
TestEnvironment = "<B>Folder " & uploadsDirVar & " does not have write permissions.</B><br>The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions."
exit function
end if
Err.Clear
testFile.Close
fso.DeleteFile(fileName)
If Err.Number<>0 then
TestEnvironment = "<B>Folder " & uploadsDirVar & " does not have delete permissions</B>, although it does have write permissions.<br>Change the permissions for IUSR_<I>computername</I> on this folder."
exit function
end if
Err.Clear
Set streamTest = Server.CreateObject("ADODB
If Err.Number<>0 then
TestEnvironment = "<B>The ADODB object <I>Stream</I> is not available in your server.</B><br>Check the Requirements page for information about upgrading your ADODB libraries."
exit function
end if
Set streamTest = Nothing
end function
function SaveFiles
Dim Upload, fileName, fileSize, ks, i, fileKey
Set Upload = New FreeASPUpload
Upload.Save(uploadsDirVar)
'createing File system Object
Set fso = Server.CreateObject("Scrip
'Delete older files
fileName = uploadsDirVar & "drawing.jpg"
if (fso.FileExists(FileName) = TRUE) then
fso.DeleteFile(FileName)
End if
fileName = uploadsDirVar & "drawing.bmp"
if (fso.FileExists(FileName) = TRUE) then
fso.DeleteFile(FileName)
End if
SaveFiles = ""
ks = Upload.UploadedFiles.keys
if (UBound(ks) <> -1) then
SaveFiles = "<B>Files uploaded:</B> "
for each fileKey in Upload.UploadedFiles.keys
If SaveFiles = "" Then
SaveFiles = Upload.UploadedFiles(fileK
'SaveFiles = "drawing.jpg" & " (" & Upload.UploadedFiles(fileK
Else
SaveFiles = SaveFiles & "; " & Upload.UploadedFiles(fileK
'SaveFiles = SaveFiles & "; " & "drawing.jpg" & " (" & Upload.UploadedFiles(fileK
End If
If ( LCase(Right(Upload.Uploade
fileName = uploadsDirVar & Upload.UploadedFiles(fileK
fileName2 = "C:\drawing.jpg"
fso.CopyFile fileName, fileName2, True
if (fso.FileExists(FileName) = TRUE) then
fso.DeleteFile(FileName)
end if
ElseIf ( lCase(Right(Upload.Uploade
fileName = uploadsDirVar & Upload.UploadedFiles(fileK
fileName2 = "C:\drawing.bmp"
fso.CopyFile fileName, fileName2, True
if (fso.FileExists(FileName) = TRUE) then
fso.DeleteFile(FileName)
end if
'Converting C:\drawing.bmp to C:\drawing.jpg
Set Executor = Server.CreateObject("ASPEx
Executor.Application = "D:\UGN_DB\Test_MainMenu\P
Executor.ShowWindow = True
strResult = Executor.ExecuteWinApp
'After converting to C:\drawing.jpg. Deleting the C:\drawing.bmp
if (fso.FileExists(FileName2)
fso.DeleteFile(FileName2)
end if
End If
Next
else
SaveFiles = "The file name specified in the upload form does not correspond to a valid file in the system."
end if
end function
%>
<%
Dim diagnostics
if Request.ServerVariables("R
diagnostics = TestEnvironment()
if diagnostics<>"" then
response.write "<div style=""margin-left:10; margin-top:30; margin-right:30; margin-bottom:20;"">"
response.write diagnostics
response.write "<p>After you correct this problem, reload the page."
response.write "</div>"
else
response.write "<div style=""margin-left:10"">"
OutputForm()
response.write "</div>"
end if
else
response.write "<div style=""margin-left:10"">"
OutputForm()
response.write SaveFiles()
response.write "<br><br></div>"
response.redirect("insert_
end if
%>
</td>
</tr>
</table>
<p> </p></td>
</tr>
</table> <p> </p>
</td>
</tr>
</table>
<!-- InstanceEndEditable --><br>
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#CCCCCC">
<tr>
<td width="23%"> <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">©2003
UGN, Inc. </font></td>
<td width="77%" align="right"> </td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>
<%
Cart_M.Close()
Set Cart_M = Nothing
%>
<%
Cust_M.Close()
Set Cust_M = Nothing
%>
<%
Cust_Plant_M.Close()
Set Cust_Plant_M = Nothing
%>
<%
Employee_M.Close()
Set Employee_M = Nothing
%>
<%
Container_M.Close()
Set Container_M = Nothing
%>
<%
UGN_Facility_M.Close()
Set UGN_Facility_M = Nothing
%>
<%
UGN_Dept_M.Close()
Set UGN_Dept_M = Nothing
%>
--------------------------
<!--#include file="Loader.asp"-->
<%
Response.Buffer = True
' load object
Dim load
Set load = new Loader
' calling initialize method
load.initialize
' File binary data
Dim fileData
fileData = load.getFileData("c:\drawi
' File name
Dim fileName
fileName = LCase(load.getFileName("c:
' File path
Dim filePath
filePath = load.getFilePath("c:\drawi
' File path complete
Dim filePathComplete
filePathComplete = load.getFilePathComplete("
' File size
Dim fileSize
fileSize = load.getFileSize("c:\drawi
' File size translated
Dim fileSizeTranslated
fileSizeTranslated = load.getFileSizeTranslated
' Content Type
Dim contentType
contentType = load.getContentType("c:\dr
' No. of Form elements
Dim countElements
countElements = load.Count
'' Value of text input field "fname"
'Dim fnameInput
' fnameInput = load.getValue("fname")
'' Value of text input field "lname"
'Dim lnameInput
' lnameInput = load.getValue("lname")
'' Value of text input field "profession"
'Dim profession
' profession = load.getValue("profession"
' destroying load object
Set load = Nothing
%>
<html>
<head>
<title>Inserts Images into Database</title>
<style>
body, input, td { font-family:verdana,arial;
</style>
</head>
<body>
<p align="center">
<b>Inserting Binary Data into Database</b><br>
<a href="show.asp">To see inserted data click here</a>
</p>
<%
CartName = Request.QueryString("CartN
CustId = Request.QueryString("CustI
CustPlant = Request.QueryString("CustP
'UploadedFile = Request.form("File")
%>
<table width="700" border="1" align="center">
<tr>
<td>File Name</td><td><%= fileName %></td>
</tr><tr>
<td>File Path</td><td><%= filePath %></td>
</tr><tr>
<td>File Size</td><td><%= fileSize %></td>
<td>File Path Complete</td><td><%= filePathComplete %></td>
</tr><tr>
</tr><tr>
<td>File Size Translated</td><td><%= fileSizeTranslated %></td>
</tr><tr>
<td>Content Type</td><td><%= contentType %></td>
</tr><tr>
<td>No. of Form Elements</td><td><%= countElements %></td>
</tr>
</table><br><br>
<p style="padding-left:220;">
<%= fileName %> data received ...<br>
<%
Response.write("Hello CartName = " & CartName & ", CustId = " & CustId & ", CustPlant = " & CustPlant & ", UploadedFile = " & UploadedFile)
Response.end
%>
<%
' Checking to make sure if file was uploaded
If fileSize > 0 Then
' Connection string
Dim connStr
set connStr = Server.CreateObject("ADODB
'connStr = "Provider=Microsoft.Jet.OL
connStr.open = "dsn=Test_UGN_DB_DSN;uid=s
' Recordset object
Dim rs
Set rs = Server.CreateObject("ADODB
'rs.Open "Files", connStr, 2, 2
sqltext = "select cartname, contenttypepicture3, Picture3Size, Picture3 from Cart_M where CartName = '" & CartName & "' and Cart_M.CustId = " & CustId & " and Cart_M.CustPlant = '" & CustPlant & "'"
rs.Open sqltext, connStr, 2, 4
'response.write("sqltext = " & sqltext & ", fileSize = " & fileSize & ", contentType " & contentType )
'response.end
' Adding data
'rs.AddNew
rs("Picture3Size") = fileSize
rs("Picture3").AppendChunk
rs("contenttypepicture3") = contentType
rs.UpdateBatch
rs.Close
Set rs = Nothing
Response.Write "<font color=""green"">File was successfully uploaded...</font>"
Else
Response.Write "<font color=""brown"">No file was selected for uploading...</font>"
End If
If Err.number <> 0 Then
Response.Write "<br><font color=""red"">Something went wrong...</font>"
End If
response.redirect("Picture
%>
</p>
<br>
</body>
</html>
--------------------------
UploadFile.asp
<%
' For examples, documentation, and your own free copy, go to:
' http://www.freeaspupload.net
' Note: You can copy and use this script for free and you can make changes
' to the code, but you cannot remove the above comment.
Class FreeASPUpload
Public UploadedFiles
Public FormElements
Private VarArrayBinRequest
Private StreamRequest
Private uploadedYet
Private Sub Class_Initialize()
Set UploadedFiles = Server.CreateObject("Scrip
Set FormElements = Server.CreateObject("Scrip
Set StreamRequest = Server.CreateObject("ADODB
StreamRequest.Type = 1 'adTypeBinary
StreamRequest.Open
uploadedYet = false
End Sub
Private Sub Class_Terminate()
If IsObject(UploadedFiles) Then
UploadedFiles.RemoveAll()
Set UploadedFiles = Nothing
End If
If IsObject(FormElements) Then
FormElements.RemoveAll()
Set FormElements = Nothing
End If
StreamRequest.Close
Set StreamRequest = Nothing
End Sub
Public Property Get Form(sIndex)
Form = ""
If FormElements.Exists(LCase(
End Property
Public Property Get Files()
Files = UploadedFiles.Items
End Property
'Calls Upload to extract the data from the binary request and then saves the uploaded files
Public Sub Save(path)
Dim streamFile, fileItem
if Right(path, 1) <> "\" then path = path & "\"
if not uploadedYet then Upload
For Each fileItem In UploadedFiles.Items
Set streamFile = Server.CreateObject("ADODB
streamFile.Type = 1
streamFile.Open
StreamRequest.Position=fil
StreamRequest.CopyTo streamFile, fileItem.Length
streamFile.SaveToFile path & fileItem.FileName, 2
streamFile.close
Set streamFile = Nothing
fileItem.Path = path & fileItem.FileName
Next
End Sub
Public Function SaveBinRequest(path) ' For debugging purposes
StreamRequest.SaveToFile path & "\debugStream.bin", 2
End Function
Public Sub DumpData() 'only works if files are plain text
Dim i, aKeys, f
response.write "Form Items:<br>"
aKeys = FormElements.Keys
For i = 0 To FormElements.Count -1 ' Iterate the array
response.write aKeys(i) & " = " & FormElements.Item(aKeys(i)
Next
response.write "Uploaded Files:<br>"
For Each f In UploadedFiles.Items
response.write "Name: " & f.FileName & "<br>"
response.write "Type: " & f.ContentType & "<br>"
response.write "Start: " & f.Start & "<br>"
response.write "Size: " & f.Length & "<br>"
Next
End Sub
Private Sub Upload()
Dim nCurPos, nDataBoundPos, nLastSepPos
Dim nPosFile, nPosBound
Dim sFieldName, osPathSep, auxStr
'RFC1867 Tokens
Dim vDataSep
Dim tNewLine, tDoubleQuotes, tTerm, tFilename, tName, tContentDisp, tContentType
tNewLine = Byte2String(Chr(13))
tDoubleQuotes = Byte2String(Chr(34))
tTerm = Byte2String("--")
tFilename = Byte2String("filename=""")
tName = Byte2String("name=""")
tContentDisp = Byte2String("Content-Dispo
tContentType = Byte2String("Content-Type:
uploadedYet = true
VarArrayBinRequest = Request.BinaryRead(Request
nCurPos = FindToken(tNewLine,1) 'Note: nCurPos is 1-based (and so is InstrB, MidB, etc)
If nCurPos <= 1 Then Exit Sub
'vDataSep is a separator like --------------------------
vDataSep = MidB(VarArrayBinRequest, 1, nCurPos-1)
'Start of current separator
nDataBoundPos = 1
'Beginning of last line
nLastSepPos = FindToken(vDataSep & tTerm, 1)
Do Until nDataBoundPos = nLastSepPos
nCurPos = SkipToken(tContentDisp, nDataBoundPos)
nCurPos = SkipToken(tName, nCurPos)
sFieldName = ExtractField(tDoubleQuotes
nPosFile = FindToken(tFilename, nCurPos)
nPosBound = FindToken(vDataSep, nCurPos)
If nPosFile <> 0 And nPosFile < nPosBound Then
Dim oUploadFile
Set oUploadFile = New UploadedFile
nCurPos = SkipToken(tFilename, nCurPos)
auxStr = ExtractField(tDoubleQuotes
' We are interested only in the name of the file, not the whole path
' Path separator is \ in windows, / in UNIX
' While IE seems to put the whole pathname in the stream, Mozilla seem to
' only put the actual file name, so UNIX paths may be rare. But not impossible.
osPathSep = "\"
if InStr(auxStr, osPathSep) = 0 then osPathSep = "/"
oUploadFile.FileName = Right(auxStr, Len(auxStr)-InStrRev(auxSt
if (Len(oUploadFile.FileName)
nCurPos = SkipToken(tContentType, nCurPos)
auxStr = ExtractField(tNewLine, nCurPos)
' NN on UNIX puts things like this in the streaa:
' ?? python py type=?? python application/x-python
oUploadFile.ContentType = Right(auxStr, Len(auxStr)-InStrRev(auxSt
nCurPos = FindToken(tNewLine, nCurPos) + 4 'skip empty line
oUploadFile.Start = nCurPos-1
oUploadFile.Length = FindToken(vDataSep, nCurPos) - 2 - nCurPos
If oUploadFile.Length > 0 Then UploadedFiles.Add LCase(sFieldName), oUploadFile
End If
Else
Dim nEndOfData
nCurPos = FindToken(tNewLine, nCurPos) + 4 'skip empty line
nEndOfData = FindToken(vDataSep, nCurPos) - 2
If Not FormElements.Exists(LCase(
End If
'Advance to next separator
nDataBoundPos = FindToken(vDataSep, nCurPos)
Loop
StreamRequest.Write(VarArr
End Sub
Private Function SkipToken(sToken, nStart)
SkipToken = InstrB(nStart, VarArrayBinRequest, sToken)
If SkipToken = 0 then
Response.write "Error in parsing uploaded binary request."
Response.End
end if
SkipToken = SkipToken + LenB(sToken)
End Function
Private Function FindToken(sToken, nStart)
FindToken = InstrB(nStart, VarArrayBinRequest, sToken)
End Function
Private Function ExtractField(sToken, nStart)
Dim nEnd
nEnd = InstrB(nStart, VarArrayBinRequest, sToken)
If nEnd = 0 then
Response.write "Error in parsing uploaded binary request."
Response.End
end if
ExtractField = String2Byte(MidB(VarArrayB
End Function
'String to byte string conversion
Private Function Byte2String(sString)
Dim i
For i = 1 to Len(sString)
Byte2String = Byte2String & ChrB(AscB(Mid(sString,i,1)
Next
End Function
'Byte string to string conversion
Private Function String2Byte(bsString)
Dim i
String2Byte =""
For i = 1 to LenB(bsString)
String2Byte = String2Byte & Chr(AscB(MidB(bsString,i,1
Next
End Function
End Class
Class UploadedFile
Public ContentType
Public Start
Public Length
Public Path
Private nameOfFile
' Need to remove characters that are valid in UNIX, but not in Windows
Public Property Let FileName(fN)
nameOfFile = fN
nameOfFile = SubstNoReg(nameOfFile, "\", "_")
nameOfFile = SubstNoReg(nameOfFile, "/", "_")
nameOfFile = SubstNoReg(nameOfFile, ":", "_")
nameOfFile = SubstNoReg(nameOfFile, "*", "_")
nameOfFile = SubstNoReg(nameOfFile, "?", "_")
nameOfFile = SubstNoReg(nameOfFile, """", "_")
nameOfFile = SubstNoReg(nameOfFile, "<", "_")
nameOfFile = SubstNoReg(nameOfFile, ">", "_")
nameOfFile = SubstNoReg(nameOfFile, "|", "_")
End Property
Public Property Get FileName()
FileName = Request.QueryString("RFQNo
End Property
'Public Property Get FileN()ame
End Class
' Does not depend on RegEx, which is not available on older VBScript
' Is not recursive, which means it will not run out of stack space
Function SubstNoReg(initialStr, oldStr, newStr)
Dim currentPos, oldStrPos, skip
If IsNull(initialStr) Or Len(initialStr) = 0 Then
SubstNoReg = ""
ElseIf IsNull(oldStr) Or Len(oldStr) = 0 Then
SubstNoReg = initialStr
Else
If IsNull(newStr) Then newStr = ""
currentPos = 1
oldStrPos = 0
SubstNoReg = ""
skip = Len(oldStr)
Do While currentPos <= Len(initialStr)
oldStrPos = InStr(currentPos, initialStr, oldStr)
If oldStrPos = 0 Then
SubstNoReg = SubstNoReg & Mid(initialStr, currentPos, Len(initialStr) - currentPos + 1)
currentPos = Len(initialStr) + 1
Else
SubstNoReg = SubstNoReg & Mid(initialStr, currentPos, oldStrPos - currentPos) & newStr
currentPos = oldStrPos + skip
End If
Loop
End If
End Function
%>
----
I want to do something in insert_from_disk.asp . So, it can pick up data from Server Hard disk. c:\drawing.jpg is server location.
fileData = load.getFileData("c:\drawi
Thanks for your patience...............
This link has a tutorial on how to read a binary (image) file and insert it into the database. I'm sure you'll find the procedure you need to plug into your code there.
http://www.stardeveloper.com/articles/display.html?article=2001033101&page=1
Good luck!
JM
http://www.stardeveloper.com/articles/display.html?article=2001033101&page=1
Good luck!
JM
use free third party components
http://www.aspsmart.com/aspSmartUpload/
you can directly upload picture to database (5 steps in one :)))
http://www.aspsmart.com/aspSmartUpload/
you can directly upload picture to database (5 steps in one :)))
also this is the most long posting
i have seen in EE :)
i have seen in EE :)
Here is a simple function i used with AspImage
PutIn("C:\temp\_002.png")
Function PutIn(filepath)
Set Image = Server.CreateObject("AspIm age.Image" )
Image.LoadImage(filepath)
Set objRS = Server.CreateObject("ADODB .Recordset ")
objRS.Open "SELECT * FROM images", dbConnStr, 1, 3
objRS.AddNew
objRS("Image1").Value = Image.Image
objRS.Update
Set objRS = Nothing
Set Image = nothing
End Function
PutIn("C:\temp\_002.png")
Function PutIn(filepath)
Set Image = Server.CreateObject("AspIm
Image.LoadImage(filepath)
Set objRS = Server.CreateObject("ADODB
objRS.Open "SELECT * FROM images", dbConnStr, 1, 3
objRS.AddNew
objRS("Image1").Value = Image.Image
objRS.Update
Set objRS = Nothing
Set Image = nothing
End Function
ASKER
Hello mk_b,
I tried your solution. I downloaded/registered ASPImage at client machine as well as Server. and modified my code as below. Code is executing fine without error. But some how I can not see any image. What's wrong in code.
'C:\drawing.jpg is available now.
Dim connStr
set connStr = Server.CreateObject("ADODB .Connectio n")
connStr.open = "dsn=Test_UGN_DB_DSN;uid=s a;pwd=arih ant;"
Set Image = Server.CreateObject("AspIm age.Image" )
Image.LoadImage("C:\drawin g.jpg")
Set objRS = Server.CreateObject("ADODB .Recordset ")
sqltext = "select cartname, contenttypepicture3, Picture3Size, Picture3 from Cart_M where CartName = '" & Request.QueryString("CartN ame") & "' and Cart_M.CustId = " & Request.QueryString("CustI d") & " and Cart_M.CustPlant = '" & Request.QueryString("CustP lant") & "'"
objRS.Open sqltext, connStr, 2, 4
'objRS.AddNew
objRS("Picture3").Value = Image.Image
objRS("contenttypepicture3 ") = "image/pjpeg"
'objRS.Update
objRS.UpdateBatch
Set objRS = Nothing
Set Image = nothing
Thanks,
Vishal.
I tried your solution. I downloaded/registered ASPImage at client machine as well as Server. and modified my code as below. Code is executing fine without error. But some how I can not see any image. What's wrong in code.
'C:\drawing.jpg is available now.
Dim connStr
set connStr = Server.CreateObject("ADODB
connStr.open = "dsn=Test_UGN_DB_DSN;uid=s
Set Image = Server.CreateObject("AspIm
Image.LoadImage("C:\drawin
Set objRS = Server.CreateObject("ADODB
sqltext = "select cartname, contenttypepicture3, Picture3Size, Picture3 from Cart_M where CartName = '" & Request.QueryString("CartN
objRS.Open sqltext, connStr, 2, 4
'objRS.AddNew
objRS("Picture3").Value = Image.Image
objRS("contenttypepicture3
'objRS.Update
objRS.UpdateBatch
Set objRS = Nothing
Set Image = nothing
Thanks,
Vishal.
ASKER
jmelika,
I already used stardeveloper's solution. But that will work if I am selecting file from browser. and uploading to database.
While my problem is to pick up the file from Server hard disk and upload it to database. I dont know how to modify 'UploadFile.asp' and 'Loader.asp'. I think, by using/modifying dictionary object in those, I can solve my prbolem.
Anyway thanks for suggestion.
I already used stardeveloper's solution. But that will work if I am selecting file from browser. and uploading to database.
While my problem is to pick up the file from Server hard disk and upload it to database. I dont know how to modify 'UploadFile.asp' and 'Loader.asp'. I think, by using/modifying dictionary object in those, I can solve my prbolem.
Anyway thanks for suggestion.
ASKER
nurbek,
I registered aspsmartupload.dll.
But, I dont find any code on their website, how to pickup idle file from Server Hard Disk and send/upload it to database ?
I dont want to pickup file from Browser and upload it to database. I want to pickup readymade .jpg file from Server and upload it to database.
Thanks,
I registered aspsmartupload.dll.
But, I dont find any code on their website, how to pickup idle file from Server Hard Disk and send/upload it to database ?
I dont want to pickup file from Browser and upload it to database. I want to pickup readymade .jpg file from Server and upload it to database.
Thanks,
what do you mean by "But some how I can not see any image" in the database you wont see any image...
modify the code below to view the file in asp.
Function GetOut(Id)
Dim rs
Set rs = Server.CreateObject("ADODB .Recordset ")
rs.Open "select Image1 from images where Id = "& Id &"", dbConnStr, 1, 2
If Not rs.EOF Then
Response.ContentType = "image/png"
Response.BinaryWrite rs("Image1")
End If
rs.Close
Set rs = Nothing
End Function
modify the code below to view the file in asp.
Function GetOut(Id)
Dim rs
Set rs = Server.CreateObject("ADODB
rs.Open "select Image1 from images where Id = "& Id &"", dbConnStr, 1, 2
If Not rs.EOF Then
Response.ContentType = "image/png"
Response.BinaryWrite rs("Image1")
End If
rs.Close
Set rs = Nothing
End Function
ASKER
mk_b,
I can not see 'picture3' field filled with any value in the table. It shows NULL in table. Well, I can see 'contenttypepicture3' field with value 'image/pjpeg'.
Normally 'picture3' shows Hexadecimal values, if picture is uploaded in reality. 'picture3' datatype is IMAGE datatype.
I am displaying picture on page using
<input type="image" border="0" name="imageField" src="file.asp?Cartname=<%= Request.Qu eryString( "Cartname" )%>&CustId =<%=Reques t.QueryStr ing("CustI d")%>&Cust Plant=<%=R equest.Que ryString(" CustPlant" )%>" width="600" height="400" >
Where File.asp file is used. file.asp is taken from www.stardeveloper.com since long time back.
I can not see 'picture3' field filled with any value in the table. It shows NULL in table. Well, I can see 'contenttypepicture3' field with value 'image/pjpeg'.
Normally 'picture3' shows Hexadecimal values, if picture is uploaded in reality. 'picture3' datatype is IMAGE datatype.
I am displaying picture on page using
<input type="image" border="0" name="imageField" src="file.asp?Cartname=<%=
Where File.asp file is used. file.asp is taken from www.stardeveloper.com since long time back.
I made this script and it works fine "Image1" is a image field in sql2000 and OLE Object in access and it works fine in both of them??? just change the conn properties below and test th script??
<%
Dim dbConnStr
'dbConnStr = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="& Server.MapPath("data.mdb") &";DefaultDir="& Server.MapPath(".") &";pwd=;DriverId=25;FIL=MS Access"
'--local
dbConnStr = "PROVIDER=MSDASQL;DRIVER={ SQL Server};SERVER=MARKB;DATAB ASE=Northw ind;UID=Us er;PWD=Pas sword;"
Function PutIn(filepath)
Set Image = Server.CreateObject("AspIm age.Image" )
Image.LoadImage(filepath)
Set objRS = Server.CreateObject("ADODB .Recordset ")
objRS.Open "SELECT * FROM images", dbConnStr, 1, 3
objRS.AddNew
objRS("Image1").Value = Image.Image
objRS.Update
Set objRS = Nothing
Set Image = nothing
End Function
Function GetOut(Id)
Dim rs
Set rs = Server.CreateObject("ADODB .Recordset ")
rs.Open "select Image1 from images where Id = 1", dbConnStr, 1, 2
If Not rs.EOF Then
Response.ContentType = "image/png"
Response.BinaryWrite rs("Image1")
End If
rs.Close
Set rs = Nothing
End Function
%>
<%
If Request.Form("Add")="yes" Then
'Server.MapPath(img)
PutIn("C:\temp\_002.png")
End If
If Request.Form("view")="yes" Then
GetOut(1)
End If
%>
<form action="tmp.asp" method="post">
Add: <input type="checkbox" name="Add" value="yes"><br>
View: <input type="checkbox" name="View" value="yes"><br>
<input type="submit" name="submit" value="do-it">
</form>
<%
Dim dbConnStr
'dbConnStr = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="& Server.MapPath("data.mdb")
'--local
dbConnStr = "PROVIDER=MSDASQL;DRIVER={
Function PutIn(filepath)
Set Image = Server.CreateObject("AspIm
Image.LoadImage(filepath)
Set objRS = Server.CreateObject("ADODB
objRS.Open "SELECT * FROM images", dbConnStr, 1, 3
objRS.AddNew
objRS("Image1").Value = Image.Image
objRS.Update
Set objRS = Nothing
Set Image = nothing
End Function
Function GetOut(Id)
Dim rs
Set rs = Server.CreateObject("ADODB
rs.Open "select Image1 from images where Id = 1", dbConnStr, 1, 2
If Not rs.EOF Then
Response.ContentType = "image/png"
Response.BinaryWrite rs("Image1")
End If
rs.Close
Set rs = Nothing
End Function
%>
<%
If Request.Form("Add")="yes" Then
'Server.MapPath(img)
PutIn("C:\temp\_002.png")
End If
If Request.Form("view")="yes"
GetOut(1)
End If
%>
<form action="tmp.asp" method="post">
Add: <input type="checkbox" name="Add" value="yes"><br>
View: <input type="checkbox" name="View" value="yes"><br>
<input type="submit" name="submit" value="do-it">
</form>
ASKER
MK_B,
I created page as below. Well, upload is still not working. I created table in my database as below.
Create table images
(id int,
image1 image)
Well, If I upload record in this table using someother way like :
Insert into images(id,image1) select 1, picture3 from cart_m where cartname = 'MEL-58613-08020'
Insert into images(id,image1) select 2, picture3 from cart_m where cartname = '58614-0C040'
Then, your GetOut(Id) function works.
But, PutIn(filepath) just insert record with Id value, not a picture.
Do you think, My ASPImage.dll has some problem ?? I just downloaded and registered it at server. Not purchased yet. I was thinking, it will work properly, then my company will purchase it.
Thanks for your so far guidance.
----------------------- TestUploadImage.asp ------------------
<%
Dim dbConnStr
'dbConnStr = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="& Server.MapPath("data.mdb") &";DefaultDir="& Server.MapPath(".") &";pwd=;DriverId=25;FIL=MS Access"
'--local
'dbConnStr = "PROVIDER=MSDASQL;DRIVER={ SQL Server};SERVER=MARKB;DATAB ASE=Northw ind;UID=Us er;PWD=Pas sword;"
set dbconnStr = Server.CreateObject("ADODB .Connectio n")
dbconnStr.open = "dsn=Test_UGN_DB_DSN;uid=s a;pwd=youg uess;"
Function PutIn(filepath)
Set Image = Server.CreateObject("AspIm age.Image" )
Image.LoadImage(filepath)
Set objRS = Server.CreateObject("ADODB .Recordset ")
objRS.Open "SELECT * FROM images", dbConnStr, 1, 3
objRS.AddNew
objRS("Image1").Value = Image.Image
objRS("Id") = 1
objRS.Update
Set objRS = Nothing
Set Image = nothing
End Function
Function GetOut(Id)
Dim rs
Set rs = Server.CreateObject("ADODB .Recordset ")
rs.Open "select Image1 from images where Id = " & id, dbConnStr, 1, 2
If Not rs.EOF Then
Response.ContentType = "image/png"
Response.BinaryWrite rs("Image1")
End If
rs.Close
Set rs = Nothing
End Function
%>
<%
If Request.Form("Add")="yes" Then
'Server.MapPath(img)
PutIn("C:\drawing.jpg")
End If
If Request.Form("view")="yes" Then
GetOut(1)
End If
%>
<form action="TestUploadImage.as p" method="post">
Add: <input type="checkbox" name="Add" value="yes"><br>
View: <input type="checkbox" name="View" value="yes"><br>
<input type="submit" name="submit" value="do-it">
</form>
---------------------
I created page as below. Well, upload is still not working. I created table in my database as below.
Create table images
(id int,
image1 image)
Well, If I upload record in this table using someother way like :
Insert into images(id,image1) select 1, picture3 from cart_m where cartname = 'MEL-58613-08020'
Insert into images(id,image1) select 2, picture3 from cart_m where cartname = '58614-0C040'
Then, your GetOut(Id) function works.
But, PutIn(filepath) just insert record with Id value, not a picture.
Do you think, My ASPImage.dll has some problem ?? I just downloaded and registered it at server. Not purchased yet. I was thinking, it will work properly, then my company will purchase it.
Thanks for your so far guidance.
----------------------- TestUploadImage.asp ------------------
<%
Dim dbConnStr
'dbConnStr = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="& Server.MapPath("data.mdb")
'--local
'dbConnStr = "PROVIDER=MSDASQL;DRIVER={
set dbconnStr = Server.CreateObject("ADODB
dbconnStr.open = "dsn=Test_UGN_DB_DSN;uid=s
Function PutIn(filepath)
Set Image = Server.CreateObject("AspIm
Image.LoadImage(filepath)
Set objRS = Server.CreateObject("ADODB
objRS.Open "SELECT * FROM images", dbConnStr, 1, 3
objRS.AddNew
objRS("Image1").Value = Image.Image
objRS("Id") = 1
objRS.Update
Set objRS = Nothing
Set Image = nothing
End Function
Function GetOut(Id)
Dim rs
Set rs = Server.CreateObject("ADODB
rs.Open "select Image1 from images where Id = " & id, dbConnStr, 1, 2
If Not rs.EOF Then
Response.ContentType = "image/png"
Response.BinaryWrite rs("Image1")
End If
rs.Close
Set rs = Nothing
End Function
%>
<%
If Request.Form("Add")="yes" Then
'Server.MapPath(img)
PutIn("C:\drawing.jpg")
End If
If Request.Form("view")="yes"
GetOut(1)
End If
%>
<form action="TestUploadImage.as
Add: <input type="checkbox" name="Add" value="yes"><br>
View: <input type="checkbox" name="View" value="yes"><br>
<input type="submit" name="submit" value="do-it">
</form>
---------------------
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I am assuming you already have the database setup to accept the file. What is the database field type that will hold that data? Is it binary or image?
Look into GetChunk function of ASP. It's the most commonly used function for uploading binary files (images included) to database directly.
That will save you step 2 and 3.
JM