Upload image to directory and data to database from the same form

Hello all
I'm playing at building a shopping cart (never done one
before) from a tutorial by Gordon Knapp at www.webthang.com.
I have created the site and it works perfectly. Now I want to
extend it.
There is a form that allows the user to add data to the
database. I would also like to be able to upload an image to a
directory on the server and add the data to the database at the
same time from the same form. It would be good if the input field
"<input name="product_picture" type="text" id="product_picture"
tabindex="6" size="50" />" could be populated automatically by
the filename of the image being uploaded, but this isn't a
neccessity.
I have looked at various ASP Upload packages and I can upload
an image alone but none of them make it clear how to upload the
image and add data to the database at the same time.
As this is a private project I need any suggestions to by
free.
The tutorial shows how to create the site in Ultra Dev but
worked perfectly well in DW. The page concerned looks like this. It
is named 'admin_add.asp':
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/con_ecom.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" &
Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
If (CStr(Request("MM_insert")) = "add_form") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_con_ecom_STRING
MM_editCmd.CommandText = "INSERT INTO products
(product_category, product_name, product_price, product_briefdesc,
product_fulldesc, product_picture) VALUES (?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param1", 202, 1, 50,
Request.Form("product_category")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param2", 202, 1, 50,
Request.Form("product_name")) ' adVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param3", 5, 1, -1,
MM_IIF(Request.Form("product_price"),
Request.Form("product_price"), null)) ' adDouble
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param4", 203, 1, 536870910,
Request.Form("product_briefdesc")) ' adLongVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param5", 203, 1, 536870910,
Request.Form("product_fulldesc")) ' adLongVarWChar
MM_editCmd.Parameters.Append
MM_editCmd.CreateParameter("param6", 202, 1, 50,
Request.Form("product_picture")) ' adVarWChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "admin_control.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0)
Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" &
Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" &
Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>Administration - Add Product</title>
<link href="../scripts/admin.css" rel="stylesheet"
type="text/css" />
<script type="text/javascript"
src="../scripts/ecom.js"></script>
</head>
<body onLoad="adminTitle()">
<div id="wrapper">
<div id="pageHeading">ADMINISTRATION - ADD
PRODUCT</div>
<div id="navBar"><a
href="admin_control.asp">Control</a> | Add | <a
href="admin_view.asp">View</a> | <a
href="admin_update1.asp">Update</a> | <a
href="admin_delete1.asp">Delete</a> | <a
href="../Default.asp">Shop</a></div>
<br />
<form name="add_form" id="add_form" method="POST"
action="<%=MM_editAction%>">
<table border="1" align="center" id="tblArea">
<tr>
<td class="tdLabel">Product Category</td>
<td colspan="2"><input name="product_category"
type="text" id="product_category" tabindex="1" size="50"
/></td>
</tr>
<tr>
<td class="tdLabel">Product Name</td>
<td colspan="2"><input name="product_name"
type="text" id="product_name" tabindex="2" size="50"
/></td>
</tr>
<tr>
<td class="tdLabel">Product Price</td>
<td class="tdContent" colspan="2"><input
type="text" name="product_price" id="product_price" tabindex="3"
size="50" /></td>
</tr>
<tr>
<td class="tdLabel">Product Short
Desciption</td>
<td class="tdContent" colspan="2"><textarea
name="product_briefdesc" id="product_briefdesc" cols="47" rows="4"
tabindex="4"></textarea></td>
</tr>
<tr>
<td class="tdLabel">Product Full
Description</td>
<td class="tdContent" colspan="2"><textarea
name="product_fulldesc" id="product_fulldesc" cols="47" rows="5"
tabindex="5"></textarea></td>
</tr>
<tr>
<td class="tdLabel">Product Image File Name</td>
<td class="tdContent" colspan="2"><input
name="product_picture" type="text" id="product_picture"
tabindex="6" size="50" /></td>
</tr>
<tr>
<td class="tdLabel"> </td>
<td align="center"><input type="reset" name="Reset"
id="Reset" value="Reset Form" /></td>
<td align="center"><input type="submit"
name="Submit" id="Submit" value="Add To Shop" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="add_form"
/>
</form>
</div>
</body>
</html>
Hope you can help.
Warm regards
Martin

Got it sorted.
Found an excellent tutorial at Webthang.
http://www.webthang.co.uk/tuts/tuts_dmx/rob15/rob15.asp

Similar Messages

  • Safari and Firefox on my desktop suddenly stopped combine ting to any website.  IPad and IPhone work fine from the same wifi. Any ideas.

    Safari and Firefox will not connect to website On desktop. IPad and IPhone work fine from the same wifi.

    Restart your router.

  • How could I play and transmit a stream from the same camera

    How could I play and transmit a stream from the same camera?

    Hi,
    As I said, you can use the method getVisualComponent() of the Processor to get a preview Window.
    You create a Processor, prepare it to generate an appropriate output DataSource for what you want to do (saving, TXing, etc).
    Then, for this Processor you extract an AWT Component where the stream will be previewed using the method getVisualComponent().
    Some of the player examples in the JMF guide use this technique. I'm still not write my own player. I'm using an adaptation of the RTPPlayer, but I'm planning to use the above technique to create a Player where I can apply some effects to the stream and then save it if the user wants to.
    If someone already did that, please, correct me if my procedure isn't right!
    By the way, thanks for your help! I was using the DataSource returned from Manager.createCloneableDataSource only to create the clones. I was feeding my main Processor with the original DataSource. That was the problem!
    RGB

  • Standalone oc4j and oracle 9i database on the same windows xp machine

    I m trying to deploy my j2ee application in my local system using standalone oc4j container(Oracle Containers for J2EE 10g (10.1.3.1)).To configure OC4j,I had to mention ORACLE_HOME=d:\oc4j as a user defined env variable.after that the oc4j started running normally.then i installed oracle 9i database in the same system to use it as the database for the application.During installation it prompts that ORACLE_HOME is alredady set.However the installation completes successfully.But when i try opening sql plus,it throws and error asking to check oracle_home.Its only after changing oracle home to d:\oracle,that sql plus opened and i could log in to it.But after that oc4j would not run saying it cannot find relevant files.Is it not possible to have standalone oc4j and a database for a J2ee application on the same system.if its possible,how can we go ahead?Thanks in advance

    user549113,
    Problem with ORACLE_HOME has been discussed several times already in this forum. I suggest you search the forum archives for "ORACLE_HOME".
    Good Luck,
    Avi.

  • My iPhone 4s is saving Notes and dates like 50 of the same note and date. WHY? HELP

    I can not take off a date that I set on my ical and it has it saved it like 100 times. Taking up alot of my space on my iPhone 4s. It is really affecting my whole phone system (texting, FACEBOOK, Pinterest, calendar, Notes, camera, EMail BIG TIME!) I trash old emails and they come right back so I have like 550 old emails. The Capacity is at 13.5 on my iPhone 4s its because of what is going on with my iphone 4s. Need help on how to clean it from a virus.   jil r  

    You don't have a virus, at least not on the iPhone. Issues is likely on the server for your email service. However you can try a reset: Simultaneously hold down the Home and On buttons until the device shuts down. Ignore the off slider if it appears. Once shut down is complete, if it doesn't restart on it own, turn the device back on using the On button. In some cases it also helps to double click the Home button and close all apps from the tray BEFORE doing the reset.

  • Get Min value and another column value from the same row

    hi all - for each customer and product, I need to grab the row that has the min value for field Value1. I could've just done group by on customer and product and min on Value1, but I also need to grab Vlaue2 from the same row where the minimum value for
    Value1 lies.
    DECLARE @Temp TABLE (CustomerID INT, ProductID VARCHAR(10), Trans_Date Date, Value1 INT, Value2 INT)
    INSERT INTO @Temp VALUES (123, 'ABC', '1/1/2013', 10, 100)
    INSERT INTO @Temp VALUES (456, 'ASD', '1/1/2013', 40, 500)
    INSERT INTO @Temp VALUES (456, 'ASD', '2/1/2013', 90, 700)
    INSERT INTO @Temp VALUES (123, 'ABC', '2/1/2013', 20, 700)
    SELECT * FROM @Temp
    The output should be
    123, ABC, 10, 100
    456, ASD, 40, 500
    I know that I can just join the table to itself and get the desired output but I am dealing with a table that has millions of rows and I was hoping there is more efficient way to do this. any help would be highly appreciated...

    Here is a correction on your DDL to make it into nearly valid table.
    CREATE TABLE Sales
    (customer_id INTEGER NOT NULL,
    product_id CHAR(10) NOT NULL,
    transaction_date DATE NOT NULL,
    PRIMARY KEY (customer_id, product_id, transaction_date),
    value1 INTEGER NOT NULL,
    value2 INTEGER NOT NULL);
    Here is the current syntax for insertion:
    INSERT INTO Sales
    VALUES (123, 'abc', '2013-01-01', 10, 100),
    (456, 'asd', '2013-01-01', 40, 500),
    (456, 'asd', '2013-02-01', 90, 700),
    (123, 'abc', '2013-02-01', 20, 700);
    WITH
    X
    AS
    (SELECT customer_id, product_id, transaction_date, value1, value2,
    MIN(value1) OVER () AS value1_min
    FROM Sales)
    SELECT X.*
    FROM X
    WHERE X.value1_min = X.value1;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Access two EAS with different Essbase versions and different java versions from the same p.c.

    Hi,
    I need to regularly access Essbase 11.1.2.2. and Essbase 11.1.2.3 EAS from the same client machine.
    They are on, and must be on, different versions of java, is there a way to have both versions of java installed but each using the correct version and without the two java versions causing any kind of problems?
    thanks,
    Robert.

    Hi Robert...  I assume this is web-launched?
    I spent a day or so trying understand the intricacies of the JNLP protocol and create shortcuts that will invoke web-launched EAS with the appropriate version of Java.  I can get one version of EAS to use the 1.6 Java Web Launcher, and the other version of EAS to use the 1.7 Java Web Launcher - but both Web Launchers eventually invoke the same version of Java!  There are switches in the JNLP syntax that seem like they should allow you choose the actual Java version that gets invoked, but I just could not make it work.
    You can use the Java Control Panel (in Control Panel) to enable and disable the relevant versions before launching EAS.
    If you find otherwise I would love to know (or if you find out how to control which versions are enabled or disabled via command-line script).

  • How to populate data in fields from the same cube

    HI Gurs,
    Need some help. I have a cube it has 11 key figures . Data for 7 of those is coming from another cube for rest of the 4 we need to calculate from two of those 7 fields. e.g.
    Field 1= Field2(First Cube) - Field3(FirstCube)
    Field4= Field5(FirstCube)/1.5
    Field 6 = Field1 / Field4
    I need to pupulate field 4 in the final cube.
    How can I achieve this?
    Can anyone please suggest anything?

    Hi Ray,
    One is as suggested by surendra i.e to populate thru End routine,take help of an ABAPer and do it.
    Else just add the new 4 KF  in the New Cube i.e Cube 2 and in the Individual Routine /Field Routine you can write the same Formula in the  Result of it.Say,For Fields 1 you have to have Field 2,Field 3 and Field 5 as input ,which you hvae include manually in the Individual/Field Routine.
    In Result for Field 1= Field2(First Cube) - Field3(FirstCube)
    In Result for Field4= Field5(FirstCube)/1.5
    In Result for Field 6 = (Field2(First Cube) - Field3(FirstCube) / Field5(FirstCube)/1.5)
    Hope you got it ....
    Rgds
    SVU123

  • Can I use SubPanels to display and run multiple executables from the same GUI?

    I have two Labview executables that performs some A/D I/O, each using an independent USB-6008.  I would like to run both of these executables from a single UI.  Is this possible usin SubPanels?  Or some other method?
    I found KB regarding exe's and VI Server but can't seem to get the suggested workarounds implemented.
    http://digital.ni.com/public.nsf/allkb/8545726A00272EB0862571DA005B896C?OpenDocument
    I am using Labview2009
    Thanks
    Dan
    Solved!
    Go to Solution.

    DBerry wrote:
    No, of course I am not sure yet.  I have only begun testing this method. 
    Not sharing common hardware (separate USM-6008s).
    Here is the whole picture:
    I have developed a top-level VI that performs Daqmx IO using a single USB-6008.  The top-level VI references a Project Daqmx Task that points to the desired 6008.  I would like to create a single UI that uses this top-level VI to control twoUSB-6008s simultaneously.  I thought I could build the top-level VI into 2 separate exes, where the only difference between the exes is the hardware it points to (one exe to each of the 6008s).  But I have been unsuccessful at running these two exes within a single UI.  I attempted use subpanels on a tab control to do this but I am unable to obtain a reference to the top-level vis once they have been built into an exe.  I have also tried building a dll and exporting the top-level vi from the dll build but i can't seem to get that to work either.  In both of these cases my Open VI reference function returns errors (Error 1445).  I am aware of the changes in referencing VIs from within an exe/dll since LV8.2 - http://digital.ni.com/public.nsf/allkb/8545726A00272EB0862571DA005B896C
    The link seems to suggest that I should be able to obtain a reference to the top-level vi within the dll but I can't get it to work.
    So I then moved on to the above method (making all the subvis reentrant).  I just haven't figured this all out yet.
    If you have suggestions on other problems I may run into please share.  I think I can eliminate my FGs but haven't gotten back to this yet.
    Thanks
    Dan
    When I am designing apps of the type you described I have kept the ned goal in mind from the begining since of the issue you are mentioning. I also don't want to tell you to throw it all away and start over. So with that in mind I have been looking at your posts and only offering the least destrutive ideas first. With that in mind I would like to invite yo uto look at the code i posted in this thread (reply #18 has a zip).
    That code shows how to realize un-dockable GUI regions but it passes the ref of the top level VI to a reentrant VI it instanciate for each undockable region. It may have enough hints and technique to give you some ideas that will work for you.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • I have lost  years worth of music  and pictures not all from the same pc how can i get it back

    I have lost years worth of music and pictures from my ipod how can i retrieve them ?

    - If photos were in your iPod Camera Roll, just restoe from backup. If they were synced to the iPOd you have to get them from where you got them the first place
    - For itunes pruchsed music see:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    - For other music you will hae to get it from where you got it the first time.

  • How to stream video AND sync Music + iPhoto from the same iTunes library ?

    Hi everybody, my iTunes library is full of Music and with movies "linked" outside itself (to a external hard disk connected to my iMac), I'd like to sync this iTunes library to my AppleTV as follows:
    1) the video should be set in streaming mode hence itself not being copied to ATV hard disk;
    2) the music and my iPhoto library should be sync'ed (hence copied!) to ATV hard disk.
    How could I achieve that ?
    Thanks a lot.
    dalrmi.

    Custom sync with Photo set to sync preferentially and all music syncable checked in the device music tabs.

  • Is it possible to store and retrieve request variables from the same page?

    I can't seem to get this to work.
    In the page constructor to retrieve the variable on reload of the page:
    String myReqValue = (String) getValue("#{requestScope.name}");
    and in public void beforeRenderResponse() {}
    setValue("#{requestScope.name}", some_var);
    Of course in th page constructor I check that its not null to know if its the first load of the page.
    Regards
    Jonathan

    Hi,
    Your setters and getters looks fine.
    This is what i did.
    public String button1_action() {
    setValue("#{requestScope.name}", "abcd");
    return "case1";
    In the page constructor .
    String check = (String) getValue("#{requestScope.name}");
    Just check whether this can help you.

  • Latin1 and latin2 in the same form with a unicode system

    We're migrating from 4.6B to 6.0, and from non-unicode to unicode. we need to print latin1 and latin2 in the same form.
    How we can do? We try with unicode-device type: in the preview seem to be good, but then (of course) if printers don't supports unicode special caracthers are bad.
    I read about a cascading fonts...
    Have you had a solution?
    tnx
    Lorenzo

    Yes.. Solved. Now latin1 and latin2 are printed on the same form, without changing any sapscript.
    But now, the layout of the print are slightly moved down, so it's missing a little bit of document, as the printer as mistaked margins. The same printer, on the same form, with another device type print correctly (except, of course, the problem on latin2).
    Tnx in advance for your solution

  • Finder crashes when uploading Images to Wordpress and Facebook

    Hi All, 
    This is a bit od a long description, but I wanted it to be specifec and detailed as I've tried a couple of searches through the discussions and none of the other solutions suggested have worked so far. 
    I'm running Snow Leopard 10.6.8 on a 2.2Ghz Core I7 MBP with 8GB of RAM. 
    I recently set up my own website and installed Wordpress. As it is a photography website, it involves a lot of image uploads, however every time I try to use the uploader and select my files through the web form, the browser hangs and so does the Finder. This behavior is the same across Chrome, Firefox and Safari.
    The only way to get things rolling is to do a hard reset (using the power button). A friend of mine has faced the same issue in his system both with Wordpress and Facebook... And the two of us a stumped.
    Here are some of the possible solutions I've tried :
    Disable Intego Firewall
    Disable Little Snitch
    Repairing disk permissions through disk utility
    Use Onyx to clear user and system caches
    My suspicions lie with java asI believe both those sites use Java based uplod applets (sure about facebook,not sure about wordpress) 
    As a last resort, I've gone to the extent of installing windows on a Paralles Vm and using the browser there to perform the upload, but this has resulted in a crash once and the finder becoming unresponsive.
    Any light you can share on the matter would be most appreciated.
    If there are any logs I need to post here, please let me know how I'd get to them as I'm not too good with the Mac OS system utilities.
    Thanks.
    Brian

    Ok took this one step further and swapped out the 8GB upgrade back to the 4GB that originally came with my laptop.This didnt solve the problem so I dont think this is related to the hardware.
    Here's one more thing I noticed though. The crash doesnt happen if you upload files the moment you turn on the PC. But after about 15 minutes of usage if I try to upload the file... system down.
    It also baffles me that finder gets taken down along with the browser......
    Anyone with a similar issue  / solution ?

  • Creating a Standby Database with the Same Directory Structure

    Hello gurus,
    I am self-learning the feature Oracle Data Guard, so I am testing it on Oracle 10g R2.
    At Oracle documentation there is a section F.4.: Creating a Standby Database with the Same Directory Structure*, that explains how to create a standby database with RMAN but there is something that I don´t understand:
    In the standby server, I created a database with the SID equal to production database* with the objetive to have the same directory structure, but when I try to startup nomount the standby database with pfile appear this expected error:
    ORA-16187: LOG_ARCHIVE_CONFIG contains duplicate, conflicting or invalid attributes
    So my question is: Is possible have the Same Directory Structure on both: Production and StandBy server?
    Thanks in advanced.

    Uwe and mseberg: thanks for your quick answers
    I have a doubt: How can you have the same directory structure if you have differents SIDs?, for example if you follow the OFA suggestions you would must have:
    On Production server: */u01/app/oracle/oradata/PRIMARY/system.dbf*
    On StandBy server: */u01/app/oracle/oradata/STANDBY/system.dbf*
    Or you created the directory structure manually on StandBy server? For example replacing the string STANDBY* to PRIMARY* before create the database using dbca.
    Do you understand my doubt? Excuse me for my english.
    Thanks.

Maybe you are looking for

  • PS CS6 on one computer with multiple users.

    PS CS6, one computer multiple users. Only Admin Users are able to save Actions created, non admin users can not.  This is a Gov. Computer that is not specific to one user, and is managed by an IT department.  need a solution to allow non admin users

  • Do I need a power converter for my ipad in Ireland?

    Do I need a power converter for my ipad2 and my macbook air (11 inch 2010) in Ireland? Sorry, I'm new to this site and just found the answer to my question in another post.

  • XBOX 360 on iMac?

    Sorry if other people have asked this, but can you play XBOX 360 on an iMac using EyeTV Hybrid? If so, will be able to output HD graphics?

  • BT Vision - recordings to be deleted?

    Forgive me if this has been answered elsewhere My elderly parents have just had a phone call from 08000285085 telling them that unless they watch their recorded programs on their black BT vision box they will be deleted in 14 days. Is this correct? I

  • Enable a user on domino by denyGroups

    I was able to disable a user in domino by using the following code, but when I enable the user, I want to remove the user from denyGroups but I doesn't seem to work. code to disbale <set name='disableView.resourceAccounts.selectAll'>