Upload Images and Rename Rules

I've never used the Renaming option when uploading images via ADDT. How
can I force files to be renamed such that [a] all spaces are replaced by
underscores, and [b] the file name and extension are converted to lowercase?
Example:
User uploads "My New Photo.JPG". I want it uploaded as "my_new_photo.jpg".
Alec
Adobe Community Expert

Hi Alec,
1. in "includes/common/KT_functions.inc.php" you´ll have to add a new function similar to this one, which will replace all chars from uploaded filenames other than alpha-numeric and "_" and "-" and "." with an underscore:
function KT_websafe_filename($text) {
return preg_replace("/[^a-zA-Z0-9\-_\.]+/", "_", $text);
2. now open "includes/common/lib/file_upload/KT_FileUpload.class.php", go to line 120 and replace the line
$fileName = KT_replaceSpecialChars($fileName, 'filter');
with...
$fileName = KT_websafe_filename($fileName, 'filter');
The function mentioned above will need some enhancement for converting the file name to lower case -- guess that adding a strtolower() will do that
Cheers,
Günter Schenk
Adobe Community Expert, Dreamweaver

Similar Messages

  • How do i create a website that allows customer to upload images and text?

    I need some help i have a friend who has asked me if i can create a website that allows them to upload their own images and text at their leisure.
    His company is in the car sales trade so they need to regularly be updating their stock, and this needs to be done by somebody with limited computer knowledge so ease of use is fairly important.
    I am using dreamweaver cs4 on a G5 Imac running Snow leopard 10.6.8, my skills are limited to creating uncomplicated websites but i am very keen to learn, i am aware of content management systems such as Druplal but have zero knowledge on how to use these.
    Any assistance would be greatly appreciated
    Andy Barrington
    www.andybarrington.com

    You can take a read here
    http://www.hotscripts.com/category/php/scripts-programs/classified-ads/autos/
    http://icloudcenter.com/auto-dealer-car-sales-script.htm
    Although putting together a form that would upload images and all the descriptions required seems like a fairly straghtforward project, depending on your current skill set.
    Gary

  • Upload image and make thumbnail

    Is that possible for ADDT to upload and resize image and make a thumbnail at the same time?

    Hi chan15,
    that´s only possible with a Custom Trigger which contains custom PHP code to create a thumbnail from the uploaded image and store it in whatever folder.
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Upload Images and giving an action to image

    Hi,
    I  want to upload images  and by clicking that image it must go to next view.
    Could you please suggest me some of the steps to upload image and to make an action on image.
    Regards,
    Anitha

    You can use FileUplod UI Element for uploading your photo.
    and to make image as action you can use LinkToAction UI Element and put the full image name(with file Ext) in ImageSource property of LinkToAction UI Element, after that create a action and put the required code for next level of prcessing
    use this running code for uploding you file
    String FileName = "temp;
           InputStream input = null;
           int i=0;
              FileIncreament();
              try {
                        String directory =".\\temp\\webdynpro\\web\\local\\yh1245_ftp"+
                        "\\Components\\com.yash.yh1245.Upload\\"+FileName+wdContext.currentContextElement().getCounter();
                             boolean sucsss = new File(directory).mkdir();
                             if(sucsss){
                                  wdComponentAPI.getMessageManager().reportSuccess("Directory Created ");
                                 File file = new File(directory+"\\"+wdContext.currentContextElement().getResourceURL().getResourceName().toString());
                                  FileOutputStream fos = new FileOutputStream(file);
                                  wdComponentAPI.getMessageManager().reportSuccess(file.getAbsolutePath());
                                  FilePath = file.getAbsolutePath();
                                  wdComponentAPI.getMessageManager().reportSuccess("AbsolutePath......."+file.getAbsolutePath());
                                  if(wdContext.currentContextElement().getResourceURL()!=null){
                                       input = wdContext.currentContextElement().getResourceURL().read(false);
                                       //wdComponentAPI.getMessageManager().reportSuccess("Resource is not null ");
                                       while((i = input.read())!=-1){
                                            fos.write(i);
                                  fos.flush();
                                  fos.close();
                                  wdComponentAPI.getMessageManager().reportSuccess("File Uploaded on server directory ");

  • Upload Images and PDFs into MDM through UI

    Hi All,
    I have a requirement where in we need to perform a mass upload of Images and PDFs into the respective tables of MDM through a UI.
    It is like, I browse the files through UI and click on Upload button, all those Images and PDFs should be uploaded in MDM.
    Is this a possible scenario? I have searched through sdn but could find no information pertaining to it.
    Please let me know if this is a possible scenario and provide some links to any documents related to it.
    TIA,
    Sravan

    upload of images and pdfs are dome from the data manager in MDM.
    ideally whatever u do in the DM is possible to be achieved by using the MDM APIs.
    so in ur UI (Webdynpro/ Java) u should call the APIsfor upload to the respective tables and its very much possible.
    check the MDM API list for more details.
    thanks
    -Adrivit

  • Upload image and send to email

    I'd like the user to browse to select their photo and then upon hitting 'send' the image they select would be emailed to me. Can someone refer a simple execution for scripts associated with this functionality? I'm developing a jquery mobile app but working within dreamweaver cs6. So in theory it should work very similar to rigging a website with the same functionality.
    Cheers,

    The script needs to reside on the server where your form is located.  Your script should validate form fields, collect and send data to the email address you specify in your script.   It should also conceal your email address from harvesters and have good security and spam prevention measures built-in.
    If your server-supports PHP, I recommend this script from DB Masters.
         Formm@ailer PHP from DB Masters
         http://dbmasters.net/index.php?id=4
    Others I've heard good things about:
        FormToEmail.com (free & pro versions available)
        http://formtoemail.com/formtoemail_pro_version.php    
        Tectite
        http://www.tectite.com/formmailpage.php
        Forms to Go from Bebosoft (script generating software)
        http://www.bebosoft.com/products/formstogo/overview/
    Nancy O.

  • Upload Image file and retrieve image file

    How to upload image and How to retrieve image file from Database?
    Plz., give some example
    I am waiting for your valuable guidance.
    Plz., help me any one.

    This question has been asked and answred so meny times.
    I dont feel like writing the answer yet another time so please doa search.

  • How to upload image using JSP

    hi,
    i am confronting a problem how to upload image from local PC to web server . I am using Tomcat 4.0
    please help me by sending code
    thanks

    Hi,
    Here is the solution for uploading images and displaying images. I am using struts with JSP, so this code has a Action and ActionForm class. You can put the same code in Java Beans or Servlet class to run it. This code has two JSP files - one for Upload (upload.jsp)and other for Image(image.jsp) display. It has a Servlet also to display the image. Here is the code file wise.
    Upload.jsp **********************************************************
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <html:html>
    <head>
    <title>New Page 1</title>
    </head>
    <body>
    <html:form action="uploadAction.do" enctype="multipart/form-data" method="POST">
    <p>File to upload   
    <html:file property="fileUpload" size="20"/></p>
    <p><html:submit value="Upload" property="upload"/></p>
    <p> </p>
    <p><html:img src="image.jsp"/></p>
    <p> </p>
    </html:form>
    </body>
    </html:html>
    Image.jsp*****************************************************************
    <jsp:useBean id="upload" class="uploadtest.uploadActionForm" scope="session">
    </jsp:useBean>
    <%
         byte[] rgb=(byte[])session.getAttribute("byte");
         request.setAttribute("byArr", rgb);
    %>
    <!--
    The image data is now on the request object.
    Forward the user to the showImage servlet.
    That servlet will process and display the image data contained on the request object.
    -->
    Image is<p>
    <jsp:forward page="/showimage" />
    Struts Action Class - UploadAction.java **************************************************
    import javax.servlet.http.*;
    import java.io.*;
    import org.apache.struts.upload.FormFile;
    import org.apache.struts.action.*;
    public class uploadAction extends Action {
    public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
    uploadActionForm upload = (uploadActionForm) actionForm;
    try {
    int size=upload.getFileUpload().getFileSize();
    //if (image != null) {
    byte[] byteArr = new byte[size];
    //Create an input stream to read the uploaded file.
    ByteArrayInputStream bytein = new ByteArrayInputStream(upload.getFileUpload().getFileData());
    // Load the input stream into the byte Array.
    bytein.read(byteArr);
    // Close the input stream.
    bytein.close();
    // Load the byte[] into the content field.
    upload.setContent(byteArr);
    HttpSession ses=httpServletRequest.getSession();
    ses.setAttribute("byte",byteArr);
    return actionMapping.findForward("success");
    } catch (Exception ex) {
    ex.printStackTrace();
    return actionMapping.findForward("success");
    Struts ActionForm class ---uploadActionForm.java***************************************************
    package uploadtest;
    import org.apache.struts.action.*;
    import org.apache.struts.upload.*;
    import javax.servlet.http.*;
    public class uploadActionForm extends ActionForm {
    private FormFile fileUpload;
    private byte[] content;
    public FormFile getFileUpload() {
    return fileUpload;
    public void setFileUpload(FormFile fileUpload) {
    this.fileUpload = fileUpload;
    public byte[] getContent()
    return content;
    public void setContent(byte[] theFile)
    this.content = theFile;
    public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
    /**@todo: finish this method, this is just the skeleton.*/
    return null;
    public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
    Servlet to display image --- ShowImage.java ********************************************************
    import java.io.*;
    import java.util.*;
    public class ShowImage extends HttpServlet {
    //Initialize global variables
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    byte[] rgb = (byte[]) request.getAttribute("byArr");
    if (rgb != null)
    response.setContentType("image/gif");
    OutputStream stream = response.getOutputStream();
    stream.write(rgb);
    else
    response.setContentType("text");
    response.getWriter().write("attribute byArr not found");
    This code will enable to to upload and display the image. If you know Struts, then you can write the Struts-Config.xml file by yourself. Other wise write to me, I will send you that. If you want to save the image in database, then you have to keep it as BLOB datatype is database. For database you need to send the byte array in the uploadAction.java file to database. Database will keep the image as binary.
    Thanks
    Amit

  • Load image and video dynamically...

    Hello. Can I make a "Browse..." button in a "Settings" slide (at the beginning of the presentation), to point my presentation to a certain photo (one photo) and video (one video) files from a HDD? I want to use those files in one of next slides... Thank You!

    I was able to create a file with 2 buttons that will upload image and video separatly and it works fine.
    But what I want is there is a 3rd button for submitting the selected files, right now the files are uploaded as soon they are selected and the browse window is closed..
    How do I get to upload the selected files only when the SUBMIT button is clicked. Please help.
    var imageTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png");
    // Assign the document types filter
    var videoTypes:FileFilter = new FileFilter("Flash Movies (*.avi, *.flv, *.mov, *.swf)", "*.swf");
    // Add both filter types to an array
    var imgTypes:Array = new Array(imageTypes);
    var vdoTypes:Array = new Array(videoTypes);
    upload_image.addEventListener(MouseEvent.CLICK, browseImage);
    upload_vdo.addEventListener(MouseEvent.CLICK, browseVdo);
    var fileRefList:FileReferenceList = new FileReferenceList();
    function browseImage(event:MouseEvent):void {
        fileRefList.browse(imgTypes);
        fileRefList.addEventListener(Event.SELECT, selectHandler);
    function browseVdo(event:MouseEvent):void {
        fileRefList.browse(vdoTypes);
        fileRefList.addEventListener(Event.SELECT, selectHandler);
    function selectHandler(event:Event):void
        var request:URLRequest = new URLRequest("fileUploadScript.php");
        var file:FileReference;
        var files:FileReferenceList = FileReferenceList(event.target);
        var selectedFileArray:Array = files.fileList;
        for (var i:uint = 0; i < selectedFileArray.length; i++)
            file = FileReference(selectedFileArray[i]);
            file.addEventListener(Event.COMPLETE, completeHandler);
            try
                file.upload(request);
            catch (error:Error)
                trace("Unable to upload files.");
    function completeHandler(event:Event):void
        trace("uploaded");

  • Upload images to a muse site

    I want to design a form that allows users to upload images and submit them to my email. is this possible in muse?

    Hi
    Please refer to this thread :
    http://forums.adobe.com/message/6216497#6216497
    Thanks,
    Sanjit

  • What's the best way to upload images to Blogger?

    My mom is an illustrator and has a very active blog for her work (updates daily). She needs to be able to upload images and publish posts from her ipad, because it's her only portable device. We've figured out that she can do it by uploading the images to photobucket, but it would be nice if there was another way that is less roundabout.
    We are talking about three different sources of images: images created right on the iPad using Brushes 3 (or similar drawing/art apps if she decides to try those), artwork created on paper with pencils and inks that she has scanned at home and needs to take along so she can publish them on the road, and pen and ink images that she photographs with the ipad instead of scanning them (because she made them on the road and there's no scanner to be had). The blog is on Blogger and the iPad is the latest one (the New iPad aka iPad 3).
    If you can help out with that, I'll be grateful because it's been a bit of a headache! And I'll see if I can convince her to make something for the winning answer
    thanks!

    Oh, wow.  I have exactly the same problem of LR not assigning keywords to all my selected images.
    I will try the grid, select the grid and not the filmstrip, and look for the current image metadata checkbox as well.
    BTW, Adobe told me to delete the preferences file, which I did.
    They told me to optomize the catalog, which I did.
    And, lastly they told me to create a new catalog and import all the data from my old catalog, which I did not do.
    Stand by ...
    Wow, that is it.  You folks solved my problem.
    Library Mode, select in the grid OR filmstrip (yep-but harder to see in the filmstrip anyway),
    COULD NOT FIND-look for the current image metadata checkbox as well.
    Michael

  • Code wont work when trying to upload image!

    My Code wont work when I try to upload an image to mysql. (Field in mysql is BLOB)
    <!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>insert</title>
    <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
    <?php require_once('Connections/drama_database.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO databaseimage (name, image) VALUES (%s, %s)",
                           GetSQLValueString($_POST['name'], "text"),
                           GetSQLValueString($_POST['image'], "double"));
      mysql_select_db($database_drama_database, $drama_database);
      $Result1 = mysql_query($insertSQL, $drama_database) or die(mysql_error());
    mysql_select_db($database_drama_database, $drama_database);
    $query_image = "SELECT * FROM databaseimage";
    $image = mysql_query($query_image, $drama_database) or die(mysql_error());
    $row_image = mysql_fetch_assoc($image);
    $totalRows_image = mysql_num_rows($image);
    ?>
    </head>
    <body>
    <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="form1" id="form1">
    Name:  <span id="sprytextfield1">
      <label for="name"></label>
      <input type="text" name="name" id="name" />
      <span class="textfieldRequiredMsg">A value is required.</span></span>
      <p>
        <label for="image"></label>
        <input type="file" name="image" id="image" />
      </p>
      <p>
        <input type="submit" name="Upload" id="Upload" value="Upload" />
      </p>
      <input type="hidden" name="MM_insert" value="form1" />
    </form>
    <script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    </script>
    </body>
    </html>
    <?php
    mysql_free_result($image);
    ?>
    Any help would be very much appreciated!

    OK, that tutorial is different than what I assume you want. I suspect you want the ability to have users upload images and store the metadata of those images in a database, correct? That tutorial only shows how to upload to a specific location so the image can
    be displayed in an iframe.
    Search for "php file upload scripts" to see how to upload to a file system and store the metadata in the database.
    >and no, mostly i have used the dreamweaver features to avoid it as much as possible
    As you are seeing, DW code is very limited in what it can do. It also generates code that is not up to current standards,and is very difficult to work with if you need to modify it. Basically, it's junk. Forget it and learn how to read and write code. There are tons on tutorials on how to get started with PHP.  DW Server behaviors only seem like a time saver in the beginning. In the end, you'll end up wasting more time using them than learning how to code yourself.

  • KMC WIKI 7.30 - Upload Image error

    Hello,
    if I try to upload an image I get this error:
    FreeMarker template error!
    Expression action.fieldErrors["Filedata"] is undefined on line 821, column 36 in template/global/image-picker.ftl.
    The problematic instruction:
    ==> list action.fieldErrors["Filedata"] as error [on line 821, column 29 in template/global/image-picker.ftl]
    Java backtrace for programmers:
    freemarker.core.InvalidReferenceException: Expression action.fieldErrors["Filedata"] is undefined on line 821, column 36 in template/global/image-picker.ftl.
    at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)

    See snote 1554787.
    But the Problem still exist. You cannot upload images and attach files, images and others to wiki pages.
    KMC-UI 1000.7.30.2.1.20110522175000
    KMC-WIKI 1000.7.30.2.1.20110518212000
    attachment
    Admin Error
    We're sorry but a serious error has occurred in the system.
    jive.error.log:
    [error] com.sap.sql.log.OpenSQLException: The SQL statement "INSERT INTO WIK_AttachData (attachmentID, attachmentData) VALUES (?, EMPTY
    _BLOB())" contains the syntax error[s]: - 1:80 - SQL syntax error: the token "(" was not expected here
    com.jivesoftware.base.database.dao.DAOException: com.sap.sql.log.OpenSQLException: The SQL statement "INSERT INTO WIK_AttachData (attachmentID, attachmentD
    ata) VALUES (?, EMPTY_BLOB())" contains the syntax error[s]: - 1:80 - SQL syntax error: the token "(" was not expected here
            at com.jivesoftware.community.impl.dao.DbAttachmentDAO.saveAttachmentData(DbAttachmentDAO.java:395)
            at com.jivesoftware.community.impl.DbAttachment.insert(DbAttachment.java:555)
            at com.jivesoftware.community.impl.DbAttachment.<init>(DbAttachment.java:93)
    upload image
    FreeMarker template error!
    Expression action.fieldErrors["Filedata"] is undefined on line 821, column 36 in template/global/image-picker.ftl.
    The problematic instruction:
    ==> list action.fieldErrors["Filedata"] as error [on line 821, column 29 in template/global/image-picker.ftl]
    Java backtrace for programmers:
    freemarker.core.InvalidReferenceException: Expression action.fieldErrors["Filedata"] is undefined on line 821, column 36 in template/global/image-picker.ftl.
         at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
         at freemarker.core.IteratorBlock.accept(IteratorBlock.java:93)
         at freemarker.core.Environment.visit(Environment.java:196)

  • Image upload in a file and rename in the DB

    hi,
    I have a form where the user can change or add his avatar, i'd like to know what's the best way to allow image's upload (with a max size) and rename this image, something like ('username'.jpeg). this new image would replace the previous one. only one image per user. and if this user haven't upload image, a 'default.jpeg' would apear on his profile...
    Any good solution or help for this problem??
    Cheers
    Tim

    i didn't understand what you've wrote about the "SB".. is there a preset fonction to upload files on my website in DW ?
    Using Adobe Dreamweaver Developers Toolbox (ADDT - the forum you are posting in) there is a file upload SB (acronym for server behavior) located in Server behavior/Developers Toolbox/File Upload. If you do not have ADDT you do not have this server behavior and you are posting in the wrong forum. Although doubtful you might get a better answer if you don't have ADDT by posting in the Dreamweaver Application Development forum

  • I am new to Mac and am having trouble with uploading images from my pictures folder to Facebook and other share sites- some of my images are accessible while others are seemingly locked....

    I am new to Mac and am having trouble up loafing images from my pictures folder to photography sites and Facebook. Some of the saved images are accessible, while others are not, ( they are light colored and cannot be uploaded) I am not saving them any differently.

    Hi Robodisko,
    Thanks for your prompt reply...... 
    I often proof my work in preview then edit images in photoshop and rename from there.  The dsc images are renamed to correlate the name of the class etc.  i.e. dcs_001 is saved as the file name required 7A.jpeg etc.
    The file names are required to correlate what is what and so on..........

Maybe you are looking for

  • "phone offline" and other syncing issues

    There's been several threads on the "phone offline" issue across many of the big Pre forums, but we're really not heard anything constructive from Palm on the matter...  It's basically leaving me unable to do email and a number of other features that

  • Looking for a particular extension cable to connect an iPod to Roadtrip

    Wondering if this exists... I've been using a Griffin Roadtrip for months, but I no longer want my iPod mounted on it as I drive. First off, it just rattles too much (I'm nervous about damaging the bottom pieces inside). But most importantly, I've fo

  • Fatal error while running Test JSP in Jdeveloper

    Hi, After performing initial jdeveloper set ups when I run the test JSP i get following error It prompts about Port conflict. Upon clicking OK I get following error Fatal Error: Unable to write to the transaction log (/E:/p4045639_11i_generic/jdevhom

  • Mail Not Showing Images

    Since updating to 10.6.3, Mail will no longer display images. All of the settings are proper, but images display as a question mark. I've recently had to do an erase and install for other reasons and Mail still will not display images. Has anyone els

  • "Select next playlist" not working

    When I hold down the button, the voiceover scrolls through the playlists fine but then when I click on the playlist I want, it just reverts to the playlist I am already listening to. Only way to cure it (temporarily!) is to restore the whole thing!!