Insert the Image name in the database

I created a form with a file field to upload a picture and insert its name directly into the mysql database. The column type is varchar which name will be inserted via the form. Now, I get two problems. All the fields fill up the database with the exception of the name of the image. The name of the image must be inserted in the productImage column. He remanins null. No image is downloaded to the destination folder.

And also, on presentation of the form, I get this error.
Run database query error.
'ProductID' column cannot be null

I enclose the complete code. Could someone help? All I need is that the file is downloaded and name inserted in the mysql database in the specified column.

There is only two errors I see in your code:

First, you need around the loop shaped cfoutput tags - otherwise, the #i # naming fields won't work and all three will be called simply "productID #i #", etc...

Second, you must name dynamically variable 'file', no cffile. ServerFile. As each file is downloaded, the cffile. ServerFile will be associated with the value of the loop of the file [x].

I enclose your code with the changes commented so you can see what will happen. BTW, I tested this code and it works as expected.

Good luck

Tags: ColdFusion

Similar Questions

  • Error 2147024882 in the database

    Good afternoon.

    I try through OR DIAdem 2011 analyze vibration signals, the problems is that the database is in Microsoft Access and all the data were inserted as a string. I therefore did a VI that convert all data to a numeric value and generates a file of PDM DIAdem.

    This VI works perfectly with small databases, the major problem is that the files that I need to analyze are 500 MB to 700 MB and when I insert the database DB tools select data VI gives me error 2147024882, I'm guessing that locks the size of the files.

    So anyway is to insert all these data without fracture of my database?

    Thanks and regards.

    Thanks for the help, but I managed to solve the problem through tiara, create a digital channel and by copying bites generated in this new channel and DIAdema automatically converted to digital data.

  • AS2 - problem with inserting of partition/name of the database/mysql

    Hello

    First of all... Sorry that I havn't put the ACE in a box, do not know how to do it on this forum!

    Okay, so here's my problem:

    I want to submit my score and the name in my database.

    This is the script I've tried Flash.

    Stop();

    create objects loadVars

    playerx = new LoadVars();

    playerRegistered = new LoadVars();

    playerRegistered.onLoad = showResult;

    create the button handler code to call the function that sends & load php

    _root.submitt.onRelease = submitScore;

    function submitScore (): Void {}

    playerx. Name = name_txt.text;

    playerx.score = score_txt.text;

    playerx.sendAndLoad ("register.php", playerRegistered);

    }

    This is the PHP script:

    <? PHP

    $connect = mysql_connect('x.com.mysql','x','password');

    @mysql_select_db ('x', $connect);

    $sql = "INSERT INTO high_scores_avoidthecars (name, score) VALUES ("'. ")" $_POST ['name']. '"," '. $_POST ['score'].'") ';"

    ? >

    Nothing is posted to the database, no errors etc... any ideas?

    If you went thru the link I provided you should see where you need to change the code that you did to get the Flash to work code.  Here is a link to an example of work that takes into account the second part of the code in this link that involves sending data (from line 28) with your textfields, etc.

    http://www.nedwebs.com/Flash/register.html

    The main problem with your AS2 code involves the following line...

    playerx.sendAndLoad ("register.php");

    It should be...

    playerx.sendAndLoad ("register.php", playerx. 'POST');

    Here's the code I used for the example files, I did...

    AS2 CODE

    playerx = new LoadVars();

    _root.submitt.onRelease = submitScore;

    function submitScore (): Void {}

    Response.Text = "clicked\n";

    playerx. Name = name_txt.text;

    playerx.score = score_txt.text;

    playerx.sendAndLoad ("register.php", playerx, "POST");

    }

    playerx.onLoad = onLoadCallBack;

    function onLoadCallBack (success)
    {
    Response.Text += "onLoad Processed\n";

    {if (success)}
    Response.Text += "Success\n;
    Response.Text += this.lVar1 + "\n";
    Response.Text += this.lVar2;
    } else {}
    Response.Text = "load error".
    }
    }

    PHP CODE

    <>
    read the variables
    $var1 = $_POST ['name'];
    $var2 = $_POST ['mark'];

    Send variables
    echo "& lVar1 = $var1 return &";.
    echo "& lVar2 = $var2 returned as well &";.
    ?>

  • image uploaded to the database link

    Hello

    I downloaded the images in my server so now I want to show on different pages using php and mysql, so can someone tell me how I can do this in dreamweaver php codes or manual?

    Please begin your answer of the way to start step I have to do after the download of the image, I also know a database table also be require for images should this complete tutorial please. Therefore, please answer thank you.

    tanveerh86603130 wrote:

    I mean if I have uploaed images manually on the server and now when I create a new page in php with the mysql database and want to inlucde one of these uploaded image dynamcally, so how I can do, how can I create table for these images and then use this table for u place links to this image?

    If youre doing this manually - you should now have all your images in a folder on your server.

    To get dynamically on a page, you must include the name of the image in the database table.

    Create another field in your database table called - model_image

    Then insert the name of the image in this area, associated with the mobile _name - nokia_1100.jpg, samsung_2300.jpg etc.

    Back in your page model_details.php use a query as I pointed out in the other thread:

    $model_details = mysql_query ("" SELECT * FROM mobile_phones WHERE model_id = ' $model_id ' ' ") or die (mysql_error ());

    $model_details = mysql_fetch_array ($model_details);

    Then echo the image of the page according to the model_id adopted in the link to the model_details.php page. (replace "folder_name' by the name of the folder in which images are stored)

    as well as its other fields:

    All this can be done through server Dreamweavers behaviors if you do want to write your own code. Don't forget the code that Dreamweaver now uses dynamic development is outdated.

  • Error in inserting data to the database

    I use SQL to store the data when I'm insterting the data in my table and then I get the error 2147217833.

    The image that is attached to the table structure and PROCESS as I am recording insterting. I use LV2011.

    I am able to connect to the database but error by inserting

    Soved. UerId 5 and I've been insterting 6.

  • How to display an image from the file in the database

    I want to be able to display an image from the file that I have stored in a database. In the database, the image is store as a file with numbers. When I go to display only the sign of an image appears. I want to be able to display the image not the symbol for numbers of the image or file. I know I'm close I just can't understand what I'm messing, to get the image to display.

    Here is the code:

    <? PHP require Connections/Connections.php"?" >

    <? PHP

    session_start();

    {if (isset($_SESSION["fname"]))}

    }

    else {}

    Header('Location:NewRequest.php');

    }

    ? >

    <? PHP

    $User = $_SESSION ['Pnom"];

    $result = $con-> query ("SELECT ALL * from newrequest where Fname ="$User"" ");

    ? >

    <! doctype html >

    < html >

    < head >

    < link href = "CSS/Master.css" rel = "stylesheet" type = "text/css" / > "

    < link href = "CSS/Menu.css" rel = "stylesheet" type = "text/css" / > "

    < meta charset = 'utf-8 '.

    ReviewRequest < title > < / title >

    < / head >

    < body >

    < div class = "Container" >

    < div class = "Header" > < / div >

    < div class = "Menu" >

    < div id = 'Menu' >

    < nav >

    < ul class = "cssmenu" >

    < li > < a href = "Account.php" > account < /a > < /li > ""

    < li > < a href = "UpdateAccount.php" > update account < /a > < /li > ""

    < li > < a href = "NewRequest.php" > new request < /a > < /li > ""

    < li > < a href = "ReviewRequest.php" > Review Request < /a > < /li > ""

    < li > < a href = "LogOut.php" > sign out < /a > < /li > ""

    < /ul >

    < / nav >

    < / div >

    < / div >

    < div class = "LeftBody" > < / div >

    < div class = "RightBody" >

    < name of the form = "form1" method = "post" action = "" >

    < table border = "1" >

    < b >

    < td = '26' height > name < table >

    Location < td > < table >

    Description < td > < table >

    Image of < td > < table >

    < Td > status < table >

    < /tr >

    <? PHP while ($row = $result-> fetch_assoc()) {? >}

    < b >

    < class td = "GFied" > <? PHP echo $row ["Fname"];? > < table >

    < class td = "GFied" > <? PHP echo $row ['Location'];? > < table >

    < class td = "GFied" > <? PHP echo $row ['Description'];? > < table >

    < class td = "GFied" > < img src = "<?" PHP echo $row ["numero_imagenom_image"];? > "alt =" "> < table >"

    < class td = "GFied" > <? PHP echo $row ['Status'];? > < table >

    <? PHP}? >

    < /tr >

    < /table >

    < / make >

    < / div >

    < div class = "Footer" > < / div >

    < / div >

    < / body >

    < / html >

    This is what it looks like when it displays:

    Capture3.PNG

    How can I actually picture to display?

    emrenilo32520834 wrote:

    I added the .jpg but the image still does not display, the images are saved in a jpg file.

    If the images in the database to follow this format - 1234567.jpg, 9897654.jpg

    Then your original code must have worked:

    Are the images in their own folder, if so you need to add this folder for code name:

  • How can I insert values textarea one both in the database?

    I have a simple form:

    Select list - populated by a recordset that gets the list of technicians.   In this format: Label - > name of Tech value - > ID Tech

    TextArea - paste zip codes in this tech services.    In this format: 12345,12346,12347, etc...

    When I want to send the form, I want to take all postal codes and insert them into the database as a single record each with the id of the tech of the selection list.

    The code I have is:

    $zipcodes = explode(",", $_POST['textarea']);
    $countZips = (count($zipcodes));
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
    foreach($zipcodes as $key=>$value)
    {
    
    
    while ($countZips >= 1) {
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }
    
      $insertSQL = sprintf("INSERT INTO zip_zip (zip_code, tech_id) VALUES (%s, %s)",
                           GetSQLValueString($value, "int"),
                           GetSQLValueString($_POST['select'], "int"));
    
    
      mysql_select_db($database_localhost, $localhost);
      $Result1 = mysql_query($insertSQL, $localhost) or die(mysql_error());
              $countZips--;
    }
    //Done value exists
    //Now moving to next page when done
    } 
              $insertGoTo = "index.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $insertGoTo));
    }
    //END
    

    The question is - Let's say I have paste 105 postal codes into the text box.   It inserts the FIRST postal code 105 times in the database instead of insert postal code 105 individually.

    No idea what I'm doing wrong here?

    Thank you!

    You loop does. Delete this While loop, it is not necessary, and you don't need to follow the count. The foreach loop does all the work.

  • Problem with insertion of Hebrew language in the database.

    Hello

    I have improved my application Access Layer of NHibernate 1.2 to NHibernate 3.0 data.

    I have configured the database using ODP.net 11 g on upgradation.

    On insertion, it is not to throw any exception, but the Hebrew data goes like '?

    Can I get any pointer that why it's happening now.

    Here is my setup of NHibernate.

    < db:provider id = "AMACDbProvider".
    Provider = "OracleODP - 2.0".
    connectionString = "Data Source = EP;" User ID = AUSER; Password = AER1234; "/ >
    <! - for creating factory objects - >
    < object id = "NHibernateSessionFactory" type = "Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate30" >
    < property name = "Dbprovider" ref = "AMACDbProvider" / >
    < property name = "MappingAssemblies" >
    < list >
    < value > CacheMappings < / value >
    < / list >
    < / property >
    < property name = "HibernateProperties" >
    < dictionary >
    < key = "hibernate.connection.provider entry" value ="NHibernate.Connection.DriverConnectionProvider" > < / entry > "
    < enter key = "dialect" value = "NHibernate.Dialect.Oracle10gDialect" > < / entry >
    < key = "connection.driver_class entry" value ="NHibernate.Driver.OracleDataClientDriver" > < / entry > "
    < key = "enter proxyfactory.factory_class"
    value = "NHibernate.bytecode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle" / > "
    < Enter key = "hbm2ddl.keywords" value = "none" / > "
    < / dictionary >
    < / property >
    < / object >

    Windows 1255 codepage is supported by the Hebrew alphabet. (ISO 8859-8 it is.)

    You will find the names of Oracle to support these character sets, if you search for "Latin/Hebrew" in table A-4 (recommended database character sets):
    http://download.Oracle.com/docs/CD/E11882_01/server.112/e10729/applocaledata.htm#i635016

    If language letters provided by only Win - 1255 (IW8MSWIN1255) does not satisfy your app needs, you should consider migrating to the universal language support which is Unicode. Game for Unicode characters in Oracle database are named AL32UTF8.

    http://download.Oracle.com/docs/CD/E11882_01/server.112/e10729/ch6unicode.htm
    http://download.Oracle.com/docs/CD/E11882_01/server.112/e10729/ch11charsetmig.htm

    Published by: orafad on August 1, 2011 20:24

  • saving an image of the form into the database

    I used this procedure to recover an image on my forms...
    PROCEDURE get_image IS
    /* Define the local variables*/
    l_filename VARCHAR2(60);
    l_type VARCHAR2(10);
    l_item_name VARCHAR2(60);
    l_path VARCHAR2 (60);
    BEGIN
    /* Assign the values of the fields to the variables*/
    l_filename := :PICS.file_image;
    l_type := :PICS.type;
    l_path := :PICS.file_path;
    /* Assign the variable of the item where the picture will be put in the form*/
    l_item_name := 'PICS.pic1';
    /* Define the filename as the path, actual name of the file and the type of file,
    but concatenating the various
    elements from the variables*/
    l_filename:= l_path||l_filename||'.'||l_type;
    /*Use the build in procedure READ_IMAGE_FILE to retrieve the image from
    the file*/
    READ_IMAGE_FILE(l_filename,l_type,l_item_name);
    EXCEPTION
    WHEN VALUE_ERROR THEN
    message('Value Error');
    WHEN OTHERS THEN
    message('Other error');
    END;
    and I traced the columns for the image and the name of the image in the form...
    but when I click on the button Save... nothing happens... the images does not save in the database

    Why not use a BLOB column for storing the image?

    François

  • Uploading images to be saved to the database

    Guys quick question.

    Sending pictures to save to the database added to an existing form in order to save the other info as well as the name of the file to the database's

    Thank you

    Col F

    Hello

    Don't mean to any code you have a download for video and an insert for the form button. So the two forms are independent of the other looks, which is why when you make one you get only this info and when you do the other you get only the other info. You just make a shape with the included uploader. Make a form with all the fields that are included (the movie, movie page name, description of the film, the video file) after that the form must be completed, then select the file field and go to...

    Server Behaivoirs, Developer Toolbox, downloading files, download files. Follow the widgets.

  • Inserting record in the database and then display on the next Page

    Hello!

    For a while since I posted here, but I've been pulling my hair out on this one.  Here's what I want to do.  I have a page that I want to be able to enter text in two form fields, then click on "Insert disc", and then on the next page, I just submit display.  For example, on the "insert.php" page I want to enter the field ID and Joe 43569 in the first name field.  Then after I click on submit (or insert record) the next page will have a text that says: "congratulations Joe, your ID is 43569.»  Have a great day! "Or something to that effect.

    I have the database mySQL, set up and insert records into it since this page works correctly.  Here is the code of my insert.php page which I think is the issue.   I'm just confused as to which should be added to the page detail.php to have this sentence appears correctly.  Is there something that should be added to the code on the page insert.php?  Something after the detail.php on that first line?

    Thank you, thank you, thank you in advance.

    Brent

    $insertGoTo = 'detail.php ';
    If (isset {}
    $insertGoTo. = (strpos ($insertGoTo, '?'))? « & » : « ? » ;
    $insertGoTo. = $_SERVER ['QUERY_STRING'];
    }
    header (sprintf ("location: %s", $insertGoTo));
    }
    ? > <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "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 > Untitled Document < /title >
    < / head >

    < body >
    < do action = "<?" PHP echo $editFormAction;? ">" method = "post" name = "form1" id = "form1" >
    < table align = "center" >
    < tr valign = 'of basic">
    < td nowrap = "nowrap" align = "right" > ID: < table >
    < td > < input type = "text" name = "ID" value = "" size = "32" / > < table > "
    < /tr >
    < tr valign = 'of basic">
    < td nowrap = "nowrap" align = "right" > first name: < table >
    < td > < input type = "text" name = "lastName" value = "" size = "32" / > < table > "
    < /tr >
    < tr valign = 'of basic">
    < td nowrap = "nowrap" align = "right" > < table >
    < td > < input type = "submit" value = "Insert file" / > < table >
    < /tr >
    < /table >
    < input type = "hidden" name = "MM_insert" value = "form1" / >

    < / make >

    When you submit the form, the form fields values are passed to the query insert as variables of $_POST, but as soon as you redirect the user to another page, these variables are destroyed.

    There are two ways to preserve the values: use sessions and session variables, or add values to the end of the redirect URL query string. Using the variables of session is probably easier since you can do it at the top of the page that inserts data into the database without affecting the code of Dreamweaver Server behavior.

    Put this at the top of the current page:

    
    

    In details.php, add top of the page. You can then use $_SESSION ['ID'] and $_SESSION ['name'] to display the values.

  • Insert some values into the database of field boxes




    I had a similar probem and error when you use the drop-down list instead of a checkbox. It was solved by putting the SELECT name = "CarMake in the menu dropdown.

    But in the box, I don't know?
    I seem that the problem is the action page has the Form.carmake, but the page does not work. What Miss me and where should I put in the entry below page.


    The main objective is to have checked checkboxes to insert some values into the database field carmake based on what is checked.


    If the Honda checkbox is checked then
    It inserts into the carmake field value Honda.

    If the Toyota checkbox is checked then
    It inserts into the carmake field the value of Toyota.

    If both are true then 2 rows are inserted two values
    Honda and Toyota.

    Ditto for the last option.

    Thanks for your help


    Here's the error again

    error:
    Error occurred while processing request
    CARMAKE element is not defined in the FORM.

    12:21:50.050 - term Exception - in C:\CFusionMX7\wwwroot\Author\CarAddAction.cfm: line 16
    CARMAKE element is not defined in the FORM.

    line 16 is:
    "#Trim (Form.carmake), #
    Join the Code


    <! - Here is the form - >
    < html >
    < head >
    < / head >

    < body >


    < h1 > < / h1 >

    < table >
    < action = "CarAddAction.cfm cfform" method = "POST" > "
    < b >
    < td > Honda: < table >
    < td > < Center > < input type = "checkbox" name = "HONDA_MODEL" value = "HONDA" checked > < / center > < table >
    < /tr >
    < b >
    < td > Toyota: < table >
    < td > < Center > < input type = "checkbox" name = "Toyota_MODEL" value = "Toyota" Unchecked > < / center > < table >
    < /tr >
    < b >
    < td > SUBARU: < table >
    < td > < Center > < input type = "checkbox" name = "SUBARU_MODEL" value = "SUBARU" unchecked > < / center > < table >
    < /tr >



    < Tr > < td > < table > Honda model
    < td >
    < input type = "Text".
    name = "Honda_Model".
    Value =""
    size = "22".
    MaxLength = "20" >
    < table >
    < tr > < /tr >
    < Tr > < td > < table > Toyota model
    < td >
    < input type = "Text".
    name = "Toyota_Model".
    Value =""
    size = "22" >
    < table >
    < tr > < /tr >
    < Tr > < td > < table > Subaru model
    < td >
    < input type = "Text".
    name = "Subaru_Model".
    Value =""
    size = "22" >
    < table >
    < tr > < /tr >
    < td > < table >
    < td >
    < input type is 'submit' value is "Take Add to database" >
    < table >
    < /tr >

    < / cfform >
    < /table >

    < / body >
    < / html >



    <!-action page
    --------->
    < cfdump var = "#form #" >
    < name cfquery = "InsertCarInfo."
    DataSource = "#request. MainDSN #">"
    INSERT INTO Car_tab)
    car_Make,
    Honda_Model,
    Toyota_Model,
    Subaru_Model

    )
    VALUES)

    "#Trim (Form.carmake), #
    "#Trim (Form.Honda_Model), #
    "#Trim (Form.Toyota_Model), #
    "#Trim (Form.Subaru_Model) #
    )
    < / cfquery >

    You check in one or more of the boxes before continuing? Remember what I said about the form field box existing only on the page of treatment at least 1 or more checkboxes are checked on your form. Make sure you use to avoid this problem.

    What happens when you take a look at the output of your dump of form? Your fields are present?

  • How can I get a name of table 1, column A, if column B is a negative number and insert the names of table 2?

    How can I get a name of table 1, column A, if column B is a negative number and insert the names of table 2?

    What is the formula?

    You can do this with a column of "index" in table 1, as this assistance:

    The formula in C2, filled to the bottom:

    IF (B =<>

    That increments a counter each time that it finds a negative number in column B.

    In the second table, you can retrieve a list of negative values in this way:

    The formula in A2, filled to the bottom:

    = INDEX (array 1::A, CORRESPONDENCE (LINE (−1, Table 1::C), 0))

    It takes the line number, the formula is activated, subtracts 1 to the header line and look up the result in the column of table 1 C.  If it finds a match, it feeds the line number to the INDEX page with retrieves the value of the column of table 1A.

    To hide the red triangles of signage wrap the IFERROR formula, like this:

    = SIERREUR (INDEX (table 1::A, CORRESPONDENCE (LINE (−1, Table 1::C), 0)),"")

    Of course, you can also simply filter on column B without the need to set up a column from another table or index.

    SG

  • Save images from the webcam in the database

    Hello

    I managed to acquire the image of my webcam through the acquisition of vision software, but now I faced a problem because I want the image to be stored in the database so that it can be seen from a Web page (such as a video stream).

    What I did in my vi was just the image out and plugged directly into the database and data happens in the database, but when I tried to display on the Web page, it doesn't show.

    Is it possible to do this and if so is there some tutorials that I can refer?

    Use IMAQ writing file 2 VI

  • How to insert the image in the browser IMAQ instructions

    Hello

    How to insert multiple images in the browser of the IMAQ insert vi. will be taken to image in the folder.


Maybe you are looking for

  • Linux Ubuntu drivers

    Hello I'm about to make the transition from Vista to Ubuntu. As Toshiba offers no support for Linux, I wonder if this means that I have to ask all the drivers necessary + before + I install ubuntu or Ubuntu will automatically install. I saw the post

  • Mini webcam screen

    Hi all If your using the new Skype you might have seen, there is a small/mini screen corner, when your in a videochat. The screen wil appear when your going on the internet to do something else. Is it possible to close or hide the small screen from w

  • Upgrading RAM in the Qosmio G20-110

    What is the limit of RAM upgrade in a Qosmio G20-110? Right now I have 512 MB. Can I put it in 1512, by adding 1 GB in the extra slot?

  • Reset the multifunction data acquisition?

    A call to 'DAQmx Reset Device.vi' resets all modes of hardware DAQ Multifunction or only those that are associated with the task that is connected to the entry? In other words, if the material includes analog outputs, analog and e/s digital, for exam

  • All the drivers for P531H-1791?

    Can someone give me the link for all the drivers for the Aspire One P531H-1791 please? Concerning Mi32