How do i upload an image to a server and put the name into a database table

Ok, i found a php image upload script that im using for a cms
image gallery on my site. But for it to work the way i need to i
have to have certain information submited into a mysql table at the
same time. I could just make it so the user types the name of the
image in a second form, but i would rather not have to as it seems
a clumsy way to do things and opens things up to typos etc.
So, i can upload the image ok, and i can upload data to the
table, but i dont know what I have to do so that the name of the
uploaded file is automaticly inserted into the mysql table.
The first bit of code below is the form I am using to upload
the file to the server. The second bit of code is what I am using
to tell the server what the file name is.
How do I combine the 2 form into one? Please help. It is
driving me to dispair.
Attach Code
<form enctype="multipart/form-data" action="uploader.php"
method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="500000"
/>
Choose a file to upload: <input name="uploadedfile"
type="file" />
<br />
<input type="submit" value="Upload File" />
</form>
<form action="<?php echo $editFormAction; ?>"
method="post" name="form2" id="form2">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Image One</td>
<td><input type="text" name="kingsImage1"
value="<?php echo
htmlentities($row_rskingscentre['kingsImage1'], ENT_COMPAT,
'UTF-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Image Two</td>
<td><input type="text" name="kingsImage2"
value="<?php echo
htmlentities($row_rskingscentre['kingsImage2'], ENT_COMPAT,
'UTF-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Image
Three</td>
<td><input type="text" name="kingsImage3"
value="<?php echo
htmlentities($row_rskingscentre['kingsImage3'], ENT_COMPAT,
'UTF-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap"
align="right"> </td>
<td><input type="submit" value="Update record"
/></td>
</tr>
</table>
<p>  </p>
<p>
<input type="hidden" name="MM_update" value="form2" />
<input type="hidden" name="kingsHeader" value="<?php
echo $row_rskingscentre['kingsHeader']; ?>" />
</p>
</form>

jeffoirecoupe1234 wrote:
> Ok, i found a php image upload script that im using for
a cms image gallery on
> my site. But for it to work the way i need to i have to
have certain
> information submited into a mysql table at the same
time. I could just make it
> so the user types the name of the image in a second
form, but i would rather
> not have to as it seems a clumsy way to do things and
opens things up to typos
> etc.
>
> So, i can upload the image ok, and i can upload data to
the table, but i dont
> know what I have to do so that the name of the uploaded
file is automaticly
> inserted into the mysql table.
>
> The first bit of code below is the form I am using to
upload the file to the
> server. The second bit of code is what I am using to
tell the server what the
> file name is.
>
> How do I combine the 2 form into one? Please help. It is
driving me to dispair.
>
> Attach Code
>
> <form enctype="multipart/form-data"
action="uploader.php" method="POST">
> <input type="hidden" name="MAX_FILE_SIZE"
value="500000" />
> Choose a file to upload: <input name="uploadedfile"
type="file" />
> <br />
> <input type="submit" value="Upload File" />
> </form>
>
> <form action="<?php echo $editFormAction; ?>"
method="post" name="form2"
> id="form2">
> <table align="center">
> <tr valign="baseline">
> <td nowrap="nowrap" align="right">Image
One</td>
> <td><input type="text" name="kingsImage1"
value="<?php echo
> htmlentities($row_rskingscentre['kingsImage1'],
ENT_COMPAT, 'UTF-8'); ?>"
> size="32" /></td>
> </tr>
> <tr valign="baseline">
> <td nowrap="nowrap" align="right">Image
Two</td>
> <td><input type="text" name="kingsImage2"
value="<?php echo
> htmlentities($row_rskingscentre['kingsImage2'],
ENT_COMPAT, 'UTF-8'); ?>"
> size="32" /></td>
> </tr>
> <tr valign="baseline">
> <td nowrap="nowrap" align="right">Image
Three</td>
> <td><input type="text" name="kingsImage3"
value="<?php echo
> htmlentities($row_rskingscentre['kingsImage3'],
ENT_COMPAT, 'UTF-8'); ?>"
> size="32" /></td>
> </tr>
> <tr valign="baseline">
> <td nowrap="nowrap"
align="right"> </td>
> <td><input type="submit" value="Update record"
/></td>
> </tr>
> </table>
> <p>  </p>
> <p>
> <input type="hidden" name="MM_update" value="form2"
/>
> <input type="hidden" name="kingsHeader"
value="<?php echo
> $row_rskingscentre['kingsHeader']; ?>" />
> </p>
> </form>
>
>
>
Hi Jeff:
Though this does not show you how to solve this issue via a
code
snippett, there are a couple of extensions at WebAssist.com
that enable
you to do this, they are Data Assist and Digital File Pro.
When you have
time, take a look at these Solution Recipes (tutorials) that
show how
DataAssist is used and then now Digital File Pro is used in
conjunction
with DataAssist:
http://www.webassist.com/professional/products/solutionrecipe/Media_139.asp
http://www.webassist.com/professional/products/solutionrecipe/Media_112.asp
DataAssist can be used to save time when you need to build
database
search and management applications quickly, and Digital File
Pro can be
used to include file upload functionality to your form fields
while
enabling you to insert your server file name into the
database, all on
the same page.
enthusiastically,
mark haynes

Similar Messages

  • How can i upload a image file to server by using jsp or servlet.

    Hi,
    I m gurumoorthy. how can i upload a image file to server by using jsp or servlet without using third party API. pls anyone send me atleast outline of the source code.
    Pls send me anyone.
    Regards,
    Gurumoorthy.

    I'm not an applet programmer so I can't give you much advice there.
    If you want to stream the file from the server before it's entirely uploaded, then I don't believe you can treat it like a normal file. If you're just wanting to throw it up there and then listen to it, then you can treat it like a normal file.
    But again, I'm not entirely certain. You might be able to stream the start of the file from the server while you're still uploading the end of it, but it probably depends on what method you're using to do the transfer.

  • How can i open a DOC or TXT file and insert the data into table?

    How can i open a DOC or TXT file and insert the data into table?
    I have a doc file . the doc include some columns and some rows.(for example 'ID,Name,Date,...').
    I'd like open DOC file and I'd like insert them into the table with same columns.
    Thanks.

    Use the SQL*Loader utility or the UTL_FILE package.

  • How Do I Duplicate a NOARCHIVELOG to another server and change the database

    I have two servers each with a different copy of the same database.. we'll call the database POPEYE
    server A has a STAGE version of POPEYE that is in NOARCHIVELOG mode
    server B has the PRODUCTION version of POPEYE
    I need to get the database on server A and copy it to run next to the existing database on server B.
    since they have the same name, i need to change the name to POPEYESTAGE when I move it over.
    both running Windows Server 2008. both running Oracle 10g.
    I tried shutting down the database on server A, copying over the files with a new PFile and ran the CREATE CONTROLFILE script into the trace and took out all the junk, but I cannot connect to execute it.
    I copied all the files over and when I try to commect as sysdba using sqlplus i get TNS:could not resolve the connect identifier specified.
    i tried adding it to the listener and TNS names files, but it didnt work.
    I'm trying RMAN now with some difficulty.
    I am brand new to Oracle administration, this is my first administrative assignment. Please advise

    sb92075 wrote:
    876137 wrote:
    I have two servers each with a different copy of the same database.. we'll call the database POPEYE
    server A has a STAGE version of POPEYE that is in NOARCHIVELOG mode
    server B has the PRODUCTION version of POPEYE
    I need to get the database on server A and copy it to run next to the existing database on server B.
    since they have the same name, i need to change the name to POPEYESTAGE when I move it over.Will the directory names change?Yes.
    >>
    >>
    both running Windows Server 2008. both running Oracle 10g.
    I tried shutting down the database on server A, copying over the files with a new PFile and ran the CREATE CONTROLFILE script into the trace and took out all the junk, but I cannot connect to execute itWhile above is likely true, it is 100% devoid of any useful information or details.
    In the future, ALWAYS use COPY & PASTE so we can see what you do & how Oracle actually responds.There's nothing to copy paste, I clicked with my mouse and dragged to copy the files.
    I obtained a CREATE CONTROLFILE script the standard way -- ALTER DATABASE BACKUP CONTROLFILE TO TRACE.
    so here I stand with the script in hand. BUT, I cannot connect to the database to execute it, because I get the error I stated "TNS:could not resolve the connect identifier specified."
    I copied all the files over and when I try to commect as sysdba using sqlplus i get TNS:could not resolve the connect identifier specified.CURIOUS, since connecting to local DB does not require SQL*Net.I do not know what SQL*Net is. I did not use SQL*Net. I am in the DOS style commandline prompt using sqlplus.exe
    i tried adding it to the listener and TNS names files, but it didnt work.My car didn't work.
    Tell me how to make my car go .
    Is COPY & PASTE broken for you?I used it above, but here it is again.. actually got a different error message this time:
    ERROR:
    ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
    I'm trying RMAN now with some difficulty.I bet you did not bother to Read The Fine Manual.I took a course a week ago. I am reading the manual and following the instructions. Duplicating databases is not very clearly documented.
    Plus it's a test database that the users turned into a production database, so it is in noarchivelog mode, so earlier I was not able to shutdown the database so RMAN could not back it up.
    The situation I am dealing with with fairly obscure.
    >>
    I am brand new to Oracle administration, this is my first administrative assignment. Please advisepush back from the keyboard & RTFM the URL below
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10897/toc.htm
    already in-process, what I need at the moment is assistance with a specific task.
    Now if you have already memorized that manual, how about being somewhat useful and explaining to me how to duplicate a noarchivelog database into a production server that already has a database with the same name running.

  • How do I reduce an image size? Metrics and using the box handle do not work

                

    You have not said exactly what it is you are doing or where, but clicking on an image should produce the Edit Mask slider.
    There are 2 parts to what you see. The Mask which contains and crops the Image which is the picture itself and may extend beyond the mask or cover only part of the Mask. You can edjust both the position and scale of each independently.
    1. Sliding the scale will enlarge or reduce the image within the mask
    2. Clicking on the Edit Mask will highlight the Mask box with adjustment handles with the masked image appearing outside the mask faded back. You can pull at the Mask handles to adjust them.
    3. Clicking on the faded part of the Image lets you click inside the Image to move it relative to the mask, or on its handles to scale it
    4. Clicking inside the Mask lets you grab the Mask handles to rescale the Mask with the existing cropping
    5. If the image is inline (part of the text) you can click inside it and only the right and bottom handles are highlighted and draggable. You can again click on the Edit Mask to reposition and rescale the Image as above.
    Peter

  • How do I create a folder in the root of the server and put the file in it.

    I have seen this talked about but no detailed instructions on how to do that.
    Thanks

    The root of a webserver is the part to the right of your base URL.
    Connect to your webserver and locate the folder where you see the index.html file and the folder with yoursitename.
    That's the root.
    It's the default location where iWeb publishes its pages. The folder you specify in the pathname field when you setup a FTP account.
    With MobileMe and Personal Domain enabled it is the iDisk > Web > Sites folder.
    The detailed instructions are as follows :
    Add a folder.
    Done.

  • How to read a table and transfer the data into an internal table?

    Hello,
    I try to read all the data from a table (all attribute values from a node) and to write these data into an internal table. Any idea how to do this?
    Thanks for any help.

    Hi,
    Check this code.
    Here i creates context one node i.e  flights and attributes are from SFLIGHT table.
    DATA: lo_nd_flights TYPE REF TO if_wd_context_node,
            lo_el_flights TYPE REF TO if_wd_context_element,
            ls_flights TYPE if_main=>element_flights,
            it_flights type if_main=>elements_flights.
    navigate from <CONTEXT> to <FLIGHTS> via lead selection
      lo_nd_flights = wd_context->get_child_node( 'FLIGHTS' ).
    CALL METHOD LO_ND_FLIGHTS->GET_STATIC_ATTRIBUTES_TABLE
      IMPORTING
        TABLE  = it_flights.
    now the table data will be in internal table it_flights.

  • How can I remove books from my Ipad "Kindle" and put them back into Icloud "archieve"

    I have purchased a mini Ipad and loaded up Kindle.  How can I remove the books I've read from my device and move them back to Icloud archieve?

    The following info is included with the current version for the Kindle app.
    Cloud shows all items in your Kindle library.
    Device shows items you have downloaded.
    Tap an item to download it from the cloud.
    Press and hold an item to remove it from your device.

  • How do I join two tables in the same database and load the result into a destination table in a SSIS package

    Hi,
    I have a query that joins two tables in the same database, the result needs to be loaded in a destination DB table.  How do I do this in SSIS package?
    thank you !
    Thank You Warmest Fanny Pied

    Please take a look at these links related to your query.
    http://stackoverflow.com/questions/5145637/querying-data-by-joining-two-tables-in-two-database-on-different-servers
    http://stackoverflow.com/questions/7037228/joining-two-tables-together-in-one-database

  • How to access old files after wiping your computer and putting the files back on via time machine

    I had recently wiped my computer because it was running to slow. After doing so i put my backup of my computer back on via time machine. However when i try to acces those files i cant find it in the finder. However it still takes up space on my computer and lists it as other now i cant deete any files to free up space on my computer please help!

    Try using disk utility on the hard drive to repair the permissions.

  • How do I get the results of 2 text fields and put the output into another ?

    I have 2 text fields that multiply off of each other.
    My question is, is there a way to get the result of this and put it into another text field? And from that result get another result? Or do I have to get the results from a textarea?

    I have 2 text fields that multiply off of each other.I assume this really means you want to have something else multiply the contents of the two text fields. When you are using an object-oriented language, it is helpful if you consider what objects are responsible for what actions. Loose descriptions lead to confusion.
    My question is, is there a way to get the result of
    this and put it into another text field? And from
    that result get another result? Or do I have to get
    the results from a textarea?Assuming that your "text field" is a Swing text component (and not, say, an HTML text field) then it has a getText() method that returns the contents as a String. If you plan to multiply this by something then you'll want to convert it to an int or a double or maybe a BigInteger or a BigDecimal object. Are we on the right track here?

  • How to read a file and save the contents into array list

    i have textfile contains information like:
    Name: James Smith
    Customer no: 663,282
    Post code: BA1 74E
    Telephone no: 028-372632
    Last modified: Feb 10, 2008 6:50:00 PM GMT
    Name: Janet Smith
    Customer no: 663,283
    Post code: BA1 74E
    Telephone no: 028-372632
    Last modified: Jan 11, 2007 8:10:05 PM GMT
    etc...
    how can i read the contents of this textfile and put the data into an ArrayList called ArrayList<Customer> customerList.
    i knew that i need two classes, one for CustomerDetails and one for ReadFile.
    i have already done the customer class as:
    import java.util.Date;
    public class Customer
        String Name;
        int CustomerNo;
        String Postcode;
        String teleNo;
        Date lastModified;
        public Customer(String Name, int CustomerNo, String Postcode, String teleNo, Date lastModified)
         assign(Name, CustomerNo, Postcode, teleNo, lastModified);
        public void assign(String Name, int CustomerNo, String Postcode, String teleNo, Date lastModified)
         this.Name=Name;
         this.CustomerNo=CustomerNo;
         this.Postcode=Postcode;
         this.teleNo=teleNo;
         this.lastModified=lastModified;
        public String toString()
         String allDetails = "Name: "+Name+
             ", Customer No: "+CustomerNo+
             ", Postcode:"+Postcode+
             ", Telephone No: "+teleNo+
             ", Last Modified Date: "+lastModified;
         return allDetails;
    }i just wondering how can i code the ReadFile class?
    can anyone help me please. thank you in advance.

    thank you for your suggestion, but i have already started to code the readCustomer class using the Scanner.
    the code i got so far is:
    import java.util.Scanner;
    import java.io.*;
    public class readCustomer
        public static void main(String[] args)
         readCustomer("Customers.txt");
        public static void readCustomer(String filename)
         try {
             Scanner scanner = new Scanner(new File(filename));
             scanner.useDelimiter(System.getProperty("line.separator"));
             while (scanner.hasNext()) {
              processLine(scanner.next());
             scanner.close();
         } catch (FileNotFoundException e) {
             e.printStackTrace();
        public static void processLine(String line)
         Scanner scanner2 = new Scanner(line);
         scanner2.useDelimiter("\\s*:\\s*");
         String description = scanner2.next();
    *// here is where i am struggling. i don't know how to get the information after the : sign*   
    }i am currently struggling with the processLine method?
    also, i am not sure how to group a set of information and put them into the arraylist.
    Any hint, please. Thank you.
    Edited by: mujingyue on Feb 26, 2008 12:42 PM

  • How can you upload an image to MYSQL using php?

    Ok this is a joint thread with one of my other ones because no one else  was posting on it, so I did not get what I needed, so, How can you  upload an image to mysql so when some one logs on to my site, they see  or can upload there own avatar, now there are loads of problems with  this, 1) many people don't know how, 2) It's not every day you try to  encode a image into mysql, 3) Letting people upload images into mysql  can cause traffic problem with people trying to log in. So that's it.

    Uploading images into MySQL is a bad idea, for more reasons than you mention. You should store the images in a directory on the server instead. But if you want to learn the hard way, here is the method:
    The mysql data type must be blob.
    The form enctype must be multipart, like this: enctype="multipart/form-data"
    The form input field myst be type file, like this: <input type="file" name="upload"/>
    Here is example code that prepares the variable $photodata to be inserted into the database.
      $uploadfile = $_FILES['upload']['tmp_name'];
      $photoname = $_FILES['upload']['name'];
      $uploadtype = $_FILES['upload']['type'];
      if ($uploadfile != "") {
    $tempfile = fopen($uploadfile, 'rb');
    $filesize=filesize($uploadfile);
    $width=getimagesize($uploadfile);
    $widthx=$width[0];
    $heightx=$width[1];
    if (($widthx > 102) or (heightx > 135)){
    $image_too_big = " but the image size was too large and was not submitted.";
    } else {
    $photodata = fread($tempfile, filesize($uploadfile));
    $photodata = addslashes($photodata);

  • How can I upload an image to this forum

    How can I upload an image to illustrate a problem? I have a tiff image of 41K, and I click on the camera icon to try to upload it, but an error message says
    "[The content type of this image is not allowed.]". What do I have to do?
    Thanks

    You need to use a jpeg image or a PNG image. Use GraphicConverter 7.3 to change the format.

  • How can I upload a (image) file through an applet ?

    How can I upload a (image) file through an applet ?

    have a look at http://www.haller-systemservice.net/jupload/
    i'm using Apache Jakarta HTTPClient to create a new HTTP connection to the webserver and sending a new POST request, which holds the image file. (So it's RFC1867 conform)
    there is also an open source implementation of such an applet on sourceforge. it's also called JUpload, but i think it's not maintained any more.

Maybe you are looking for