Database Image Upload

I have been trying to figure out how i can upload an image to
a specific folder and also have that same upload linked with an
insert statement into my sql database.
An example would be i want to add a user to my database and
the insert record would have all the contact details for the person
and also they upload an image of themselves for security reasons.
so i want the insert resord to add the image name and
extension to the database record along with their details and have
the image uploaded to a specific location.
I think this is possible ive just been frying my brain for
the past couple of days and cant figure it out, so any help would
be greatly appreciated.
Thanks

hi Dixiegal thanks for your reply
what i have done so far is that i can allow the user to
upload an image to the correct location, so that on my first page i
have the file field where the user can select the file from their
hard drive and then click on upload.
once the click upload they are sent to another page called
uploaded_file.cfm and on that page i have simply got the cffile tag
and a textbox (displays the filename that was uploaded)
what i want it to do is once they click upload on the first
page that the image name is updated in the record on the database
and then the user is re-directed to another page automatically.
i have added the code i have at the minute on the second page
below
<cfparam name="URL.ID" default="1">
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<cfif IsDefined("FORM.MM_UpdateRecord") AND
FORM.MM_UpdateRecord EQ "form1">
<cfquery datasource="my_datasource">
UPDATE dbo.mytable
SET main_image=
<cfif IsDefined("FORM.main_image") AND #FORM.main_image#
NEQ "">
<cfqueryparam value="#FORM.main_image#"
cfsqltype="cf_sql_clob" maxlength="50">
<cfelse>
</cfif>
WHERE ID=
<cfqueryparam value="#FORM.ID#"
cfsqltype="cf_sql_numeric">
</cfquery>
<cflocation url="product_detail_edit.cfm?ID=#URL.ID#">
</cfif>
<cfquery name="rs_image" datasource="my_datasource">
SELECT ID, *
FROM dbo.table
WHERE ID =
<cfqueryparam value="#URL.ID#"
cfsqltype="cf_sql_numeric">
</cfquery>
<cffile action="upload"
destination="..\images\products\"
nameConflict="overwrite"
fileField="Form.FiletoUpload">
<cfoutput></cfoutput></p>
<form method="post" name="form1"
action="uploaded_file.cfm">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">ID:</td>
<td><cfoutput>#rs_image.ID#</cfoutput></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Main_image:</td>
<td><input type="text" name="main_image"
value="<cfoutput>#cffile.ClientFileName#.#cffile.ClientFileExt#</cfoutput>"
size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Update
record"></td>
</tr>
</table>
<input type="hidden" name="ID"
value="<cfoutput>#rs_image.ID#</cfoutput>">
<input type="hidden" name="MM_UpdateRecord"
value="form1">
</form>
again your help would be greatly appreciated
thanks

Similar Messages

  • How To - Validate Multiple Image Upload

    Ok... I have a page where user can insert some informations in a database and also upload related images (without saving to the database).
    This is a free site that I'm developing for humanitary proposes, and I do want him to be good. If people responsable for submiting information of an abandonned dog do not upload an associated image, the site will have no sucess. So, its mandatory to upload some images of the dog.
    Question: How can we validate the multiple upload image SB to be "required" and IF no image is uploaded then, no Insert transaction will be made?
    Thanks

    Hi Marcio,
    >>
    Question: How can we validate the multiple upload image SB to be "required" and IF no image is uploaded then, no Insert transaction will be made?
    >>
    well, there´s a problem with using the Multiple Image Upload *without* saving image names etc to a table :: the Insert or Update transaction that´s required to use this "multi upload" flavor, will be executed *first* and
    (just hope this isn´t plain wrong, but I don´t think so) has no clue of what´s exactly getting triggered afterwards
    This is a sort of "master/slave" chain of actions where the "slave"
    (the upload process) will just do his work after the "master"
    (the Insert transaction) has successfully done something else before -- but not vice versa.
    About the validation as such :: ADDT will always let you validate fields, as long they belong to a certain transaction -- but the "without save to database" image upload procedure is not part of the transaction, that´s why it´s not validatable.
    I would suggest using the "with save to database" multi-upload flavor instead. This variant will be adding an Insert transaction, and the uploaded file names will be part of this transaction and hence are supposed to be validatable. I hope :-)
    Now you might wonder why, because you assumingly don´t need all the file name info that has been stored. That´s right, but if you´d store that stuff in a "dummy" table which has no other purpose than to simply "be there", it might make some sense -- noone will ever force you to query that dummy table, so what ? :-)
    That´s actually all just some "food for thought" for you, as I never tried that myself -- but from knowing ADDT´s "logic", I´m somewhat certain it will work out after all.
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Multiple image upload with save to database problem

    I am developing some backend work for a client, and we recently used the Multiple image upload with save to database wizard without a problem. A few days later, we noticed that we could only upload a single file at a time - it seems that the coding is no longer able to access the flash part of this and is using the javasript function instead. I know the web hosting company has made some changes on the server, and I did some reearch and it seems that  there could be an issue with Flash 10, but has anyone else experienced anything like this? Any help is greatly appreciated.
    Thanks.
    Jeremy

    Thank you for the responses. I have already updated awhile ago, so I am wondering what happened. Not sure if during the server update, some files were replaced (unless I totally forgot to update to 1.0.1 on this site). So I reinstalled 1.0.1, deleted the includes folder from the server and uploaded my includes folder and it now works again.
    Again, thanks for the help.
    Jeremy

  • Multiple image upload with save to database wizard problem

    hi,
    i need to upload multiple images (6) in a table called pictures. i will need the names stored in the database and the files uploaded on the server. since i am new to dreamweaver i can not figure out on how to make this work.
    the multiple image upload wizard uploads the images fine and creates a subfolder with the right id but i have no file names in the database at this point. i tried the multiple image upload with save to database wizard but i only get one upload button. it worked fine with one image but i need 6 pics uploaded. the i tried to first upload the pictures with the multiple image upload wizard and use the update wizard to add the names afterwards but that did not work either. hmm. would be great if someone could help me out.
    thanks, jan

    Thank you for the responses. I have already updated awhile ago, so I am wondering what happened. Not sure if during the server update, some files were replaced (unless I totally forgot to update to 1.0.1 on this site). So I reinstalled 1.0.1, deleted the includes folder from the server and uploaded my includes folder and it now works again.
    Again, thanks for the help.
    Jeremy

  • Multiple Image upload with save to database

    Hi everyone,
    I wonder whether anyone can help me, I have been trying to use the multiple image upload with save to database wizard. When I create the page and upload it and then view it in Safari the only thing that is on the page is an upload button. When I press the upload button I am able to browse my files and select them. When this window closes a flash loading value is shown but no images have been uploaded.
    Am I missing anything? I have had no problems uploading single files and creating albums. I want to create an online gallery so that I can do a multiple upload to a specific album if this is possible.
    Cheers
    Sarah

    Hi Sarah,
    >>
    but only the filename appeared in the database and no other information was stored.
    >>
    that´s how it´s been designed also in the "single upload" -- the path_to_the_folder where the files sit in have to be determined elsewhere
    >>
    {wedimg_idalb}
    >>
    I don´t see any reference to this "dynamic data" placeholder in any of your table columns you posted -- where does this one come from ?
    >>
    1. I have multiple clients and each client has their own set of images.
    2. Each set of client images must be linked to an album via the album ID
    >>
    do you have any "foreign key" which is related to the user_table´s ID in order to make user ID 2 upload his images in album ID 2 ? How will the upload page "know" where the images are going to be uploaded to ?
    >>
    and the album page, wedding_alb
    >>
    to my mind *this* table would itself need a foreign key to the user_table in order to "map" record 2 to user ID 2 -- or do I miss something ?
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Image upload with save to database

    Quick question guys,
    Can Image upload with save to database be added to an existing form in order to save other info as well as the file name to the database.
    Thanks
    Col F

    Hi,
    Not looking at any code you have an upload button for the video and an insert for the form. So both forms are independent of each other it looks like, thats why when you do one you only get that info and when you do the other you only get the other info. You should just make one form with the uploader included. Make one form with all the fields included (movie name, movie page, movie description, movie file) after the form is completed then select the file field and go to...
    Server Behaivoirs, Developer Toolbox, File upload, upload file. Follow the widgets.

  • Multiple Image Upload with save to database not working in IE anymore

    Since updating IE to SP3 ADDT Multiple Image Upload with save to database does not work anymore in IE. It will show a regular file upload field, an does not allow selection of multiple files. It does work in Firefox, but not all my clients use firefox.
    PSE Advice.

    I would consider buying some pluggins from dmxzone.com. They
    may cost a
    bit upfront but in the long run, you've probably be saving a
    lot of
    headaches.
    http://www.dmxzone.com/
    If time's an issue, with these plugins, you could probably
    be up and
    running in a half hour. George has some really nice pluggins
    for
    Dreamweaver and well worth the money.
    Peter Raun wrote:
    >
    I am going crazy here
    > I will see if i can explain my problem here. . .
    > I am trying to use the multiple image upload with save
    to database function in
    > the developer toolbox, and it work just fine, it lets me
    select where to store
    > the filename in database and where i want to save the
    actual image on the
    > server. It is wery easy to use if you just want these
    functions.
    > But i would also like to give every image a gallery id
    in the database, so i
    > can sort them out afterwards, its not whery smart to
    upload a lot of images to
    > a folder, and in the database you just have an image id
    and an filename, i cant
    > sort them into galleries with these to collums. . . . So
    i guess i have to do
    > something with the "additional fields" when i am
    creating the server behavior
    > but i cant figure out what to do?? i would have liked if
    i could have made an
    > list/menu with all of the availible galleries, and chose
    the one that i whould
    > add images too and then that gallery id whould be added
    to those images in the
    > database.
    > I have also tried to pass on an url parameter and then
    use that as a default
    > value in the "additionel field" section but without any
    luck at all. . . I hope
    > someone here has an idea, that could help me out. . .
    > It is sooooo easy to do this, when you are uploading ONE
    image at a time, i
    > cant figure out why it has to be sooooo hard when using
    "multiple image
    > upload"
    >

  • This is my Jsp code for image upload in database:

    This is my Jsp code for image upload in database:
    -----------Upload.jsp----------------
    <html>
    <head>
    </head>
    <body bgproperties="fixed" bgcolor="#CCFFFF">
    <form method="POST" action="UploadPicture.jsp" enctype="multiform/form-data">
    <%! int update=0; %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.text.*" %>
    <%@ page import="java.sql.Date" %>
    <%@ page import="java.io.*"%>
    <%@ page language = "java" %>
    <%
    try
    String ct="3";
    String path;
    File image=new File(request.getParameter("upload"));
    path=request.getParameter("upload");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:itPlusElectronics","","");
    PreparedStatement pstmt=con.prepareStatement("insert into graphics values(?,?,?)");
    pstmt.setString(2,path);
    pstmt.setString(3,ct);
    InputStream is=new FileInputStream(path);
    pstmt.setBinaryStream(1, is, (int)(image.length()));
    int s=pstmt.executeUpdate();
    if(s>0)
    out.println("Uploaded");
    else
    %>
    unsucessfull
    <%}
    is.close();
    pstmt.close();
    catch(Exception e)
    }%>
    </p>
    <p><br>
    <img src="UploadedPicture.jsp">image</img>
    <p></p>
    </form>
    </body>
    </html>
    My database name is itPlusElectronics and the table name is "graphics".
    I have seen as a result of the above code that the image is stored in database as "Long binary data". and database table is look like as follows-------
    picture path id
    Long binary data D:\AMRIT\1-1-Picture.jpg 3
    To retrive and display i use this JSP code as--
    ------------------------UploadedPicture.jsp------------------------------
    <html>
    <head>
    </head>
    <body bgproperties="fixed" bgcolor="#CCFFFF">
    <%! int update=0; %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.text.*" %>
    <%@ page import="java.io.*"%>
    <%@ page language = "java" %>
    <%@page import="javax.servlet.ServletOutputStream"%>
    <%
    try
    String path;
    path=request.getParameter("upload1");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:itPlusElectronics","","");
    PreparedStatement pst = con.prepareStatement("SELECT * FROM graphics WHERE id ='3'");
    // pst.setString(3, id);
    ResultSet rs = pst.executeQuery();
    path=rs.getString("path");
    if(rs.next()) {
    byte[] bytearray = new byte[4096];
    int size=0;
    InputStream sImage;
    sImage = rs.getBinaryStream(1);
    response.reset();
    response.setContentType("image/jpeg");
    response.addHeader("Content-Disposition","filename=path");
    while((size=sImage.read(bytearray))!= -1 )
    response.getOutputStream().write(bytearray,0,size) ;
    response.flushBuffer();
    sImage.close();
    rs.close();
    catch(Exception e)
    %>
    </body>
    </html>
    Now after browsing a jpg image file from client side and pressing submit button ;
    I am unable display the image in the Upload.jsp file.Though I use
    <img src="UploadedPicture.jsp">image</img> HTML code in Upload.jsp
    file .
    Now I am unable to find out the mistakes which is needed for displaying the picture in the Upload.jsp page..
    If any one can help with the proper jsp code to retrive and display the image ,please please help me !!!!!!!!!!!!!!!!!!!!!!!!!!

    dketcham wrote:
    cotton.m wrote:
    >
    2) I'm looking at how you called stuff, and you're trying to call the jsp file as an image? That jsp isn't the source of the image, just a page linking to an image. I think if you really want to do things that way you're going to need to just include that jsp within the jsp you're calling it from (or you can do it the easy way, and if you have the information to get the path of the image you want, you could simply call the image from the first jsp you posted)This is incorrect.
    There are two JSPs. The second when called will (if it worked) return the source of an image as stored in the database.even when called with <img src=xx.jsp>??
    Yes.
    If any of what I say next seems obvious or otherwise negative I apologize, just trying to explain and I don't know what you know vs what you don't.
    The link in the src is just a URL not a filetype. So just because it ends with JSP does not mean it has to return HTML. The content type is determined by the browser using the Content-Type header returned by the server in the HTTP response. In this case the header is set to be a jpeg so that's what the browser will attempt to interpret the content part of the response as.
    So in fact one is not limited to just HTML or images but whatever content type you would like to return (that the browser can understand anyway). This could be HTML or it could be an image of some type or it could be a PDF or it could be an Excel spreadsheet. All you have to do in the JSP is set the header appropriately and then send content that is actually in that format.
    This does not just apply to JSP by the way but all other web programming languages. You can do similar things to produce the same results in PHP, Perl, ASP etc.
    The only JSP/Servlet complication is whether or not doing this in a JSP is a "good" idea but I am not an expert enough at that to make a definitive statement. Mostly though JDBC in a JSP is a no-no.

  • Js-error while executing Multiple Image Upload wizard

    If i want to save the configured window of Multiple Image Upload with Save to Database wizard i get this js-error: "While executing onClick in MIUploadWSaveWizard.htm, a JavaScript error occured".
    can someone help?
    thanx
    peter

    That again would be more of a question for the Cold Fusion group.
    Try http://forums.adobe.com/community/coldfusion/coldfusion_administration
    Those people will be able to help you out more.
    Brad Lawryk
    Adobe Community Expert, Dreamweaver
    Adobe Usergroup Manager, Northern British Columbia Adobe User Group

  • Multiple Image Uploading Question

    Please forgive my ignorance here but I saw the question on multiple image uploading and this is something i have been trying to do for a few days now without any success.
    I am using CS3 with ADDT and PHP
    I want to allow my users to be able to upload say 5 pictures at a time, each user has multiple photo albums the names of which are stored in mysql table, the image name is stored in a different table with a reference to the album id.
    So, I assume that i put an insert record on the page, I followed the usual process used to have a single image upload and thought it would give me or add the extra file field options on the form when telling the multi upload to allow 5 images to be uploaded, not the case. Do i have to create a form on the page first with 5 file fields or am i just missing the plot here.
    Sorry if this is just something that seems simple but i just don't seem to be able to get it to work at all. I have no working example to look over and have serach google to see if there are any tutorials for doing this but can't find any at all.
    Thank you in advance of any help and guidance given
    Regards
    Ray

    Hi Günter
    Thank you for your reply and also for the great tutorial site you run which has helped me quite a lot with several things.
    ok, so i am maybe a little confused here, so what is the multiple image uploader for if not for uploading multiple images, and how does it give you the option to select more than one file or is it that you can't use it when inserting the image file into a database?
    Please forgive my ignornace again, i can see when i have tried using the multiple image upload thatit puts a text link called upload, what is that for because it doesn't seem to do anything on the page i have tried it on?
    Kind Regards
    Ray

  • ADDT multiple image upload: "error 500"

    Right now, I have managed to get the update record form wizard working, the right input ends up in the correct fields in the database.
    So I'm left fighting with the "multiple image upload", which gives me an "error 500" message (error connecting to server)
    The window does show me the correct files in the correct folder, but when I try and upload an image I always get the error 500 message.
    I have read that the "multiple file upload" uses a temporary folder, and Im assuming that the "multiple image upload" does the same, and I suppose that I should CHMOD that folder to 777.
    Do you know where I can find that folder?
    Can anyone help me with that error?
    Please?
    Sorry about my name, I tried a lot of other names, and all were taken, but this random name went just fine

    I thought it did - When I used the upload and save to database it saved the original images in a folder and created a sub folder called "thumbnails" and saved the thumbnails - origianl filesname just with width and height appended at the end.
    I checked my server files and their definately created.
    I browsed the java script and the help files which mentions it does this but I would like to be able to change the naming format of the thumbanils if possible

  • Multiple Image Upload Wizard Not Creating A Form

    I'm working on a new site and I keep running the multiple image upload wizard.
    It connects to the database fine, gets the primary key and all that. It sees the two columns that should be included in the form field in addition to the image_url field.
    When I hit finish on the wizard all the proper code seems to be created except the form. The upload button is the only user interface element created.
    Anybody got ideas on what is causing this? I've used this wizard on other projects sucessfuly, but I can't figure out what I'm doing differently here.
    thanks,
    - Tanner

    I believe you have to create the form first with some File Upload fields then run the Wizard.
    Cheryl

  • Image upload in mysql Databse is working fine of IE bt not in Firefox?

    i hav developed an application of image upload in mysql database,it is working good in Internet Explorer but showing exception of " java.io.FileNotFoundException: (The system cannot find the file specified)" in Mozilla Firefox.
    i'm sending my java servlet code here ,please help me out.
    * uploadData.java
    * Created on July 17, 2008, 12:11 PM
    import java.io.*;
    import java.sql.*;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.PreparedStatement;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.sql.rowset.serial.SerialBlob;
    public class uploadData extends HttpServlet {
    String mysql_driver = null;
    String mysql_url=null;
    String mysql_pwd=null;
    ServletConfig servletConfig;
    Connection con=null;
    ResultSet rs=null;
    PreparedStatement pstmt=null;
    FileInputStream fis=null;
    String currentYear;
    String nextYear;
    String letterNo;
    String currentAmount;
    String actualExpenditure;
    String fp;
    public void init(ServletConfig config) throws ServletException {
    servletConfig = config;
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    ServletContext context= servletConfig.getServletContext();
    fp=request.getParameter("uploadfile");
    currentYear=request.getParameter("currentYear");
    nextYear=request.getParameter("nextYear");
    letterNo=request.getParameter("letterNo");
    currentAmount=request.getParameter("currentAmount");
    actualExpenditure=request.getParameter("actualExpenditure");
    HttpSession session=request.getSession();
    String userName = (String) session.getAttribute("User");
    String institute = (String) session.getAttribute("inst");
    mysql_driver =context.getInitParameter("jdbcdriver");
    mysql_url=context.getInitParameter("jdbcurl");
    mysql_pwd=context.getInitParameter("password");
    mysql_url=mysql_url + "&" + mysql_pwd;
    try {
    fis=new FileInputStream(fp);
    byte b[]=new byte[fis.available()];
    fis.read(b);
    fis.close();
    Blob blob=new SerialBlob(b);
    Class.forName(mysql_driver).newInstance();
    con=DriverManager.getConnection(mysql_url);
    String query="insert into uploads (FILENAME,BINARYFILE,user_id,nameOrganization,currentYear,nextYear,letterNo,currentAmount,actualExpenditure) values (?,?,?,?,?,?,?,?,?)";
    pstmt=con.prepareStatement(query);
    pstmt.setString(1,fp);
    pstmt.setBlob(2,blob);
    pstmt.setString(3,userName);
    pstmt.setString(4,institute);
    pstmt.setString(5,currentYear);
    pstmt.setString(6,nextYear);
    pstmt.setString(7,letterNo);
    pstmt.setString(8,currentAmount);
    pstmt.setString(9,actualExpenditure);
    out.print("-----------"+query);
    //pstmt.executeUpdate();
    int i=pstmt.executeUpdate();
    if(i>0)
    out.println("Image Stored in the Database");
    else
    out.println("Failed");
    } catch (Exception ex) {
    out.print("*******************"+ex);
    ex.printStackTrace();
    out.close();
    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /** Handles the HTTP <code>GET</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    /** Handles the HTTP <code>POST</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    /** Returns a short description of the servlet.
    public String getServletInfo() {
    return "Short description";
    // </editor-fold>
    in variable " fp " in IE it is showing complete path of image but in firefox only name of image.
    please help me.......
    Thanks in Advance.

    thanks for your help,
    i had also tried this application by taking help from javazoom.upload, using multipart request,
    but that is was working fine,but the problem with that was i not only hav to upload a file in the same page i also have to save other textbox value (parameters).
    i have used 2-3 solutions to upload but the main prblm coming in my way is to save other information apart from uploaded file.
    with that MultipartRequest i'm unable to save all those information  to mysql database.
    thats why i used this way.
    Note give me hint so that solution can work on both Explorer.
    one more thing please tell me ,will this work on remote server ,as our site is hosted from other place ,we do't hav permission to access (in case of absolute path).
    please help me out............where i'm going wrong.
    thankx

  • Image upload not working

    I have an image upload script that upload the image, but does not allow the name of the image to be inserted into the database.
    Here is the code
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "signup3")) {
      $updateSQL = sprintf("UPDATE player SET photo=%s WHERE player_id=%s",
                           GetSQLValueString($_FILES['ufile']['name'], "text"),
                           GetSQLValueString($_POST['user'], "int"));
      mysql_select_db($database_db, $db);
      $Result1 = mysql_query($updateSQL, $db) or die(mysql_error());
      $updateGoTo = "team-control.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $updateGoTo));
    //define a maxim size for the uploaded images in Kb
    define ("MAX_SIZE","50000");
    //This function reads the extension of the file. It is used to determine if the file  is an image by checking the extension.
    function getExtension($str) {
             $i = strrpos($str,".");
             if (!$i) { return ""; }
             $l = strlen($str) - $i;
             $ext = substr($str,$i+1,$l);
             return $ext;
    //This variable is used as a flag. The value is initialized with 0 (meaning no error  found) 
    //and it will be changed to 1 if an errro occures. 
    //If the error occures the file will not be uploaded.
    $errors=0;
    //checks if the form has been submitted
    if(isset($_POST['Submit']))
         //reads the name of the file the user submitted for uploading
         $image=$_FILES['ufile']['name'];
         //if it is not empty
         if ($image)
         //get the original name of the file from the clients machine
             $filename = stripslashes($_FILES['ufile']['name']);
         //get the extension of the file in a lower case format
              $extension = getExtension($filename);
             $extension = strtolower($extension);
         //if it is not a known extension, we will suppose it is an error and will not  upload the file, 
        //otherwise we will do more tests
    if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif"))
            //print error message
                 echo '<h1>Unknown extension!</h1>';
                 $errors=1;
             else
    //get the size of the image in bytes
    //$_FILES['image']['tmp_name'] is the temporary filename of the file
    //in which the uploaded file was stored on the server
    $size=filesize($_FILES['ufile']['tmp_name']);
    //compare the size with the maxim size we defined and print error if bigger
    if ($size > MAX_SIZE*1024)
        echo '<h1>You have exceeded the size limit!</h1>';
        $errors=1;
    //we will give an unique name, for example the time in unix time format
    //$image_name=time().'.'.$extension;
    //the new name will be containing the full path where will be stored (images folder)
    $newname=$image;
    //we verify if the image has been uploaded, and print error instead
    $copied = copy($_FILES['ufile']['tmp_name'], $newname);
    if (!$copied)
        echo '<h1>Copy unsuccessfull!</h1>';
        $errors=1;
    //If no errors registred, print the success message
    if(isset($_POST['Submit']) && !$errors)
         echo "<h1>File Uploaded Successfully!</h1>";
    I dont know why its not working...I've used this same script in the same way in another website and it works fine.

    Check with your host for permission settings. If it works locally, and on other servers, then the code works, it just may not work in the particular
    environment your host has set up.
    Lawrence Carmer - *Adobe Community Professional*
    http://www.Cartweaver.com
    Complete Shopping Cart Application for
    Dreamweaver, available in PHP and ColdFusion
    Stay updated - http://blog.cartweaver.com

  • Multiple Image Upload with Save to DB - any help would be appreciated

    Hi - I'm running into the following issue when using the Multiple Image Upload with Save to DB behaviour.
    When I click the link to upload multiple files, I am given the list of local files to choose to upload. No problem here - I can select multiple files.
    When i select choose, the uploader shows the progress but hangs at 0%
    However (if I cancel the uploads), the first image of the group is uploaded and it's corresponding database entry is entered correctly.
    Anyone else have this hangup? If so how did you get around it?
    Thanks!
    Dan

    Just thought I would update.
    The problem seems to be related to redirecting.
    I had specified a redirect page, which of course stops the flash file from continuing to upload images after the first one.
    Anyone know how to change this so when the flash uploader finished it goes back to a list page?
    Thanks again.

Maybe you are looking for