Forums
This topic is locked
Pure Upload Saving images sizes in database
Posted 27 Jun 2007 04:01:16
1
has voted
27 Jun 2007 04:01:16 Christian Nankervis posted:
<font face='Arial'>Hi, I have followed the tutorial for saving the width and height of your picture in the database for the Pure Upload ASP.NET component and th javascript doesn't put the width and height in the hidden feilds after you have selected the file. Could someone please let me know why it's not going in?
Please find my code below.</font id='Arial'>
<pre id=code><font face=courier size=2 id=code>
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" Debug="true" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<%@ Register TagPrefix="DMXzone" NameSpace="PureUpload" Assembly="PureUpload" %>
<DMXzone<img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>ureFileUpload runat="server" id="pfu" ThePath="" Redirect="" StoreType="file" TimeOut="1200" SizeLimit="" Extensions="GIF,JPG,JPEG,BMP,PNG" NameConflict="uniq" MaxHeight="" MinHeight="" RequireUpload="true" MinWidth="" MaxWidth="" SaveWidth="PImgWidth" SaveHeight="PImgHeight" FormName="createProduct" ProgressBar="" ProgressWidth="300" ProgressHeight="100" TheVersion="2.0.2" /><MM:Update
runat="server"
CommandText='<%# "UPDATE cn12012065.products SET PImgWidth=?, PImgHeight=?, PImg=? WHERE PID=?" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_aConn" %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_aConn" %>'
Expression='<%# Request.Form("MM_update" = "createProduct" %>'
CreateDataSet="false"
SuccessURL='<%# "result_product.asp" %>'
Debug="true"
><Parameters>
<Parameter Name="@PImgWidth" Value='<%# IIf((Request.Form("PImgWidth" <> Nothing), Request.Form("PImgWidth", "" %>' Type="VarChar" />
<Parameter Name="@PImgHeight" Value='<%# IIf((Request.Form("PImgHeight" <> Nothing), Request.Form("PImgHeight", "" %>' Type="VarChar" />
<Parameter Name="@PImg" Value='<%# IIf((pfu.getFileName("PImg" <> Nothing), pfu.getFileName("PImg", "" %>' Type="VarChar" />
<Parameter Name="@PID" Value='<%# IIf((Request.Form("PID" <> Nothing), Request.Form("PID", "" %>' Type="Integer" />
</Parameters>
</MM:Update>
<MMataSet
id="dsPID"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_aConn" %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_aConn" %>'
CommandText='<%# "SELECT * FROM cn12012065.products WHERE PID = ?" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@PID" Value='<%# IIf((Request.QueryString("PID" <> Nothing), Request.QueryString("PID", "" %>' Type="Integer" />
</Parameters>
</MMataSet>
<MM<img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>ageBind runat="server" PostBackBind="true" />
<script runat="server">
Private Sub Page_Load(sender As Object, e As System.EventArgs)
'Response.Write("Shared Session Variable Names/Values between Classic ASP and ASP.NET:<BR>"
Dim i As Integer
For i = 0 To Session.Contents.Count - 1
'Response.Write(("Assigned to """ + Session.Keys(i).ToString() + """")
'Response.Write((" Value: " + Session(i).ToString() + "<BR>")
Next i
'Response.Write(Session.Contents.Count)
If Session.Contents.Count = 0 Then
Response.Redirect("/siteadmin/menu.asp"
End If
If Session("logged" <> "true" AND Session("UserAccess" <> "admin" Then
Response.Redirect("/siteadmin/menu.asp"
End If
'Response.Write(Session("logged")
End Sub 'Page_Load
</script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<title>Edit Product Image - CraftBrewer</title>
<link rel="stylesheet" type="text/css" href="/common/admin.css" />
<script language='javascript' src='../../ScriptLibrary/incPureUpload.js'></script>
</head>
<body>
<!-- Begin Wrapper -->
<div id="wrapper">
<div id="header">
<!--#include virtual="/siteadmin/includes/inc_header.asp" -->
</div>
<!-- Begin Left Column - Menu -->
<div id="leftcolumn">
<!--#include virtual="/siteadmin/includes/inc_admin_menu.asp" -->
</div>
<!-- End Left Column - Menu -->
<!-- Begin Right Column - Content -->
<div align="left" id="rightcolumn">
<h5>Upload Product Image</h5>
<div id="content">
<table border="0" cellspacing="10" cellpadding="0" class="textError">
<tr>
<td>» To upload your product image please fill out the form located below and click the <strong>Upload Product Image »</strong> button located at the bottom of the form. <br />
» All fields that are marked with an asterix * are required fields. </td>
</tr>
</table>
</div>
<div id="content">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<form method='post' enctype="multipart/form-data" name='createProduct' id='createProduct' runat='server' onsubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',true,'','','','','','PImgWidth','PImgHeight');return document.MM_returnValue">
<tr>
<td align="left" valign="top"><h5>Product Details</h5>
<table width="100%" border="0" cellpadding="3" cellspacing="0" class="textBlack">
<tr valign="baseline">
<td align="left" valign="middle" class="borderBottomAdmin"><strong>Code:</strong></td>
<td colspan="3" class="borderBottomAdmin"><%# dsPID.FieldValue("PCode", Container) %></td>
</tr>
<tr valign="baseline">
<td width="15%" align="left" valign="middle" class="borderBottomAdmin"><strong>Name:</strong></td>
<td colspan="3" class="borderBottomAdmin"><%# dsPID.FieldValue("PName", Container) %></td>
</tr>
<tr valign="baseline">
<td width="15%" align="left" valign="top" class="borderBottomAdmin"><strong> Description:</strong></td>
<td colspan="3" valign="top" class="borderBottomAdmin"><%# dsPID.FieldValue("PDesc", Container) %></td>
</tr>
<tr valign="baseline">
<td width="15%" align="left" valign="top" class="borderBottomAdmin"><strong> Display Order:</strong></td>
<td colspan="3" valign="top" class="borderBottomAdmin"><%# dsPID.FieldValue("POrder", Container) %></td>
</tr>
<tr valign="baseline">
<td align="left" valign="middle" class="borderBottomAdmin"><strong>Weight:</strong></td>
<td colspan="3" class="borderBottomAdmin"><%# dsPID.FieldValue("PWeight", Container) %></td>
</tr>
<tr valign="baseline">
<td align="left" valign="middle" class="borderBottomAdmin"><strong>Price:</strong></td>
<td colspan="3" class="borderBottomAdmin"><%# dsPID.FieldValue("PPrice", Container) %></td>
</tr>
<tr valign="baseline">
<td align="left" valign="middle" class="borderBottomAdmin"><strong>Tax Included: </strong></td>
<td colspan="3" class="borderBottomAdmin"><%# dsPID.FieldValue("PTaxIsInclusive", Container) %></td>
</tr>
<tr valign="baseline">
<td align="left" valign="middle" class="borderBottomAdmin"><strong>Tax Code: </strong></td>
<td colspan="3" class="borderBottomAdmin"><%# dsPID.FieldValue("PTaxCode", Container) %></td>
</tr>
<tr valign="baseline">
<td width="15%" align="left" valign="middle" class="borderBottomAdmin"><strong>In Stock: </strong></td>
<td colspan="3" class="borderBottomAdmin"><%# dsPID.FieldValue("PStock", Container) %></td>
</tr>
<tr valign="baseline">
<td width="15%" align="left" valign="middle" class="borderBottomAdmin"><strong>Stock Alert: </strong></td>
<td colspan="3" class="borderBottomAdmin"><%# dsPID.FieldValue("PStockAlert", Container) %></td>
</tr>
<tr valign="baseline">
<td width="15%" align="left" valign="middle" class="borderBottomAdmin"><strong>Online:</strong></td>
<td colspan="3" class="borderBottomAdmin"><%# dsPID.FieldValue("POnline", Container) %></td>
</tr>
<tr valign="baseline">
<td align="left" valign="middle" class="borderBottomAdmin"><strong>Latest Release: </strong></td>
<td colspan="3" class="borderBottomAdmin"><%# dsPID.FieldValue("PLatestRelease", Container) %></td>
</tr>
</table>
<h5>Image Upload</h5>
<table width="100%" border="0" cellpadding="3" cellspacing="0" class="textBlack">
<tr valign="baseline">
<td width="15%" align="left" valign="middle" class="borderBottomAdmin"><strong>Image:</strong></td>
<td colspan="3" class="borderBottomAdmin"><input name="PImg" type="file" class="formField" id="PImg" onchange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',true,'','','','','','PImgWidth','PImgHeight')" value='<%# dsPID.FieldValue("PImg", Container) %>' size="50" /></td>
</tr>
</table>
<br>
<input name="PID" type="hidden" id="PID">
<input type="hidden" name="PImgWidth" id="PImgWidth" value="">
<input type="hidden" name="PImgHeight" id="PImgHeight" value="">
<input type="submit" name="createProduct" value="Upload Product Image »" class="formButton" onMouseOver="this.className='formButtonOver'" onMouseOut="this.className='formButton'" />
</td>
</tr>
<input type="hidden" name="MM_update" value="createProduct">
</form>
</table>
</td>
</tr>
</table>
</div>
</div>
<!-- End Right Column - Content -->
<!-- Begin Footer -->
<div id="footer">
<!--#include virtual="/siteadmin/includes/inc_footer.asp" -->
</div>
<!-- End Footer -->
</div>
<!-- End Wrapper -->
</body>
</html>
</font id=code></pre id=code>