How do I save a file to a server using flex and coldfusion?

How do I save a file to a server using flex and coldfusion?
On the CF side I might need to use this:
<cffile action="UPLOAD" filefield="Filedata"
destination="#expandpath('..\somepath)#"
nameconflict="overwrite">
And on the flex side I might need to use something like this:
var sendVars:URLVariables = new URLVariables();
sendVars.action = "upload";
var request:URLRequest = new URLRequest();
request.data = sendVars;
request.url = _strUploadScript;
request.method = URLRequestMethod.POST;
_refUploadFile = new FileReference();
_refUploadFile = _arrUploadFiles[_numCurrentUpload].data;
_refUploadFile.addEventListener(ProgressEvent.PROGRESS,
onUploadProgress);
_refUploadFile.addEventListener(Event.COMPLETE,
onUploadComplete);
_refUploadFile.addEventListener(IOErrorEvent.IO_ERROR,
onUploadIoError);
_refUploadFile.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
onUploadSecurityError);
_refUploadFile.upload(request, "file", false);
I just don't know how to put it all together in Coldfusion.

try this...
http://cf-creations.co.uk/blog/index.cfm/2008/9/20/Flex--File-Upload-Form--Part-One--Build ing-The-Initial-Form

Similar Messages

  • How can I save a file in the server?

    Hello,
    I am writing a Java Web Start program that it will generate a html file, how can I save the generated file in the server, fro example, the directory where I stored my JAR files. Because right now, it will create the html file in the local client mahcine instead of the server. Can anyone tell me how can I do this? Thanks you.

    Yeah, thanks but that's not what I was trying to ask.
    I know that you can save and open a document by performing these three steps:
    1. Confirming to save a file to the Downloads folder
    2. Open the download manager by clicking the temporarily green arrow
    3. Clicking on the downloaded file
    What I would like to know is whether or not it is possible to have Firefox open a saved file ''automatically''. At the moment, if I choose to open it automatically, it is only saved to my temp folder.
    It would be great though if it was saved to my Downloads folder ''and'' opened with the respective program on my pc. Is there a way to do this?

  • How to upload a file to the server using ajax and struts

    With the following code iam able to upload a file ato the server.
    But my problem is It is working fine if iam doing in my system nd when iam trying to
    access theis application from someother system in our office which are connected through lan
    iam getting an error called 500 i,e internal server error.
    Why it is so???????
    Plz help me????????
    It is required in my project.
    I want the code to access from every system.
    My exact requirement is i have to upload a file to the server and retrive its path and show it in the same page from which we
    have uploaded a file.
    Here the file has to be uploaded to the upload folder which is present in the server.Iam using Tomcat server.
    Any help highly appreciated.
    Thanks in Advance
    This is my input jsp
    filename.jsp
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    <script type="text/javascript">
    alertflag = true;
    var xmlHttp;
    function startRequest(file1)
         if(alertflag)
         alert("file1");
         alert(file1);
    xmlHttp=createXmlHttpRequest();
    var video=document.getElementById("filepath").value;
    xmlHttp.open("POST","FilePathAction.do",true);
    xmlHttp.onreadystatechange=handleStateChange;
    xmlHttp.setRequestHeader('Content-Type', application/x-www-form-urlencoded');
    xmlHttp.send("filepath="+file1);
    function createXmlHttpRequest()
         //For IE
    if(window.ActiveXObject)
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
         //otherthan IE
    else if(window.XMLHttpRequest)
    xmlHttp=new XMLHttpRequest();
    return xmlHttp;
    //Next is the function that sets up the communication with the server.
    //This function also registers the callback handler, which is handleStateChange. Next is the code for the handler.
    function handleStateChange()
    var message=" ";
    if(xmlHttp.readyState==4)
         if(alertflag)
              alert(xmlHttp.status);
    if(xmlHttp.status==200)
    if(alertflag)
                                       alert("here");
                                       document.getElementById("div1").style.visibility = "visible";     
    var results=xmlHttp.responseText;
              document.getElementById('div1').innerHTML = results;
    else
    alert("Error loading page"+xmlHttp.status+":"+xmlHttp.statusText);
    </script></head><body><form >
    <input type="file" name="filepath" id="filepath" onchange="startRequest(this.value);"/>
    </form>
    <div id="div1" style="visibility:hidden;">
    </div></body></html>
    The corresponding action class is FIlePathAction
    package actions;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.*;
    public class FilePathAction extends Action{
         public ActionForward execute(ActionMapping mapping, ActionForm form,
                   HttpServletRequest request, HttpServletResponse response)
                   throws IOException, ServletException
              String contextPath1 = "";
              String uploadDirName="";
              String filepath="";
                        System.out.println(contextPath1 );
                        String inputfile = request.getParameter("filepath");
                        uploadDirName = getServlet().getServletContext().getRealPath("/upload");
                        File f=new File(inputfile);
    FileInputStream fis=null;
    FileOutputStream fo=null;
    File f1=new File(uploadDirName+"/"+f.getName());
    fis=new FileInputStream(f);
         fo=new FileOutputStream(f1);
                        try
         byte buf[] = new byte[1024*8]; /* declare a 8kB buffer */
         int len = -1;
         while((len = fis.read(buf)) != -1)
         fo.write(buf, 0, len);
                        catch(Exception e)
                                  e.printStackTrace();
                        filepath=f1.getAbsolutePath();
                        request.setAttribute("filepath", filepath);
                        return mapping.findForward("filepath");
    Action-mappings in struts-config.xml
    <action path="/FilePathAction"
                   type="actions.FilePathAction">
                   <forward name="filepath" path="/dummy.jsp"></forward>
              </action>
    and the dummy.jsp code is
    <%=request.getAttribute("filepath")%>

    MESSAGE FROM THE FORUMS ADMINISTRATORS and COMMUNITY
    This thread will be deleted within 24 business hours. You have posted an off-topic question in an area clearly designated for discussions
    about Distributed Real-time Java. Community members looking to help you with your question won't be able to find it in this category.
    Please use the "Search Forums" element on the left panel to locate a forum based on your topic. A more appropriate forum for this post
    could be one of:
    Enterprise Technologies http://forums.sun.com/category.jspa?categoryID=19
    David Holmes

  • How to put a .mov file on a dvd using lion and have a commercial DVD player play my movie? iDVD is gone.  I never had it.

    I have found a lot of frustration around this topic but no answers. 
    I have a MacBook Pro with Mac OS X Version 10.7.4.
    I have a video I made with iMovie.  I want to burn it to a DVD for commercial DVD playback.  It's as simple as that. 
    Things I've tried. 
    1. Using iMovie, I saved an HD version of the project to my desktop as a .MOV file.  I know I can just burn that to a DVD.  It won't play.  I need a utility/program to put the necessary files on the DVD so a commercial namebrand DVD player will have what it needs. 
    2. I heard iDVD used to do this but it's not on my MacBook Pro (Lion OS).  I've researched things like "What replaced iDVD" but found nothing but a but of complaining.  (and I can see why).
    3. I have looked for freeware.  It all looks fishy. 
    Other options I'm looking into.
    Use my Mac and connect a cable to the big TV screen.  Play the movie using this screen as a secondary monitor.  Problem - I have a dozen cables but none for this combo. 
    Move the .MOV file to a PC and play it using QuickTime.  The cables I have will work for a PC to TV.  Sad option. 

    Have you tried...     Burn 2.5.1 (FREE)
                                       http://www.macupdate.com/app/mac/21992/burn
                                       http://burn-osx.sourceforge.net/Pages/English/home.html
    Give it a try, it may just serve as the temporary fix you are looking for. Make sure to download the 64-bit version.
    Paid alternatives...
    miDVD Pro
    http://itunes.apple.com/us/app/midvd-pro/id529728401?mt=12
    DVD-Creator
    http://itunes.apple.com/us/app/dvd-creator/id428417852?mt=12
    Xilisoft DVD Creator 7
    http://itunes.apple.com/us/app/xilisoft-dvd-creator-7/id433594067?mt=12
    Easy DVD Creator
    http://itunes.apple.com/us/app/easy-dvd-creator/id471833133?mt=12

  • How to upload images to server using flex and blazeDS

    Hi All,
         Could you some help me, regarding uploading two images while click on the upload button. i am have two browse buttons and two upload buttons. i am able to select the image, while click on the browse button. but i am unable to upload the image, while click on the upload button. like this, i have to do in my application.
    if some help me i will appreciate , its very urgent.
    Thanks
    venkat

    When uploading a file, I use a byte array as a temporary buffer..
    So, you should then be able to store the byte array in the
    database as binary data.
    example>
    //Temporary Buffer To Store File
    byte[] tmpbuffer = new byte[860];
    //Some Code To Upload File...
    //File Should Now Be In Byte Array
    //Get DB Connection and execute Prepared Statement
    Connection con=//GET DB CONNECTION;
    String sql=insert into TABLE(page) values(?);
    PreparedStatement ps=con.prepareStatement(sql);
    ps.setBytes(1,tempbuffer);
    ps.executeUpdate();
    //Close PS and Free DB Connection
    ..... and this method looks like you dont even have
    to store the file in a byte array, you can just give
    it the input stream.
    ps.setBinaryStream(int, inputStream, int);
    You may have to make several attempts at this. I have
    uploaded a file and temporarily stored it in a byte array,
    but have never from there stored it in the DB as binary
    data.. but this looks like it'll work.
    Good Luck!

  • How can I create a directory on my server using FTP in applescript?

    Hi
    I have created a script which successfully uploads files to my server using FTP and a curl command.
    The one thing I haven't worked out how to do is how to create a directory on my server using applescript. At the moment I have to manually create the correct directory for the script to work, but would like to be able to automate everything.
    Would this be possible?
    Thanks
    Nick

    Thanks Bernard.
    I have tried that and still get the error message:
    "curl: Can't open '--ftp-create-dirs'!
    curl: try 'curl --help' or 'curl --manual' for more information
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
    curl: (9) Server denied you to change to the given directory"
    The other relevant parts of the script are:
    set ftp_url to "ftp.****.org.uk/artists/" & artistName2 & "/assets/"
    set ftp_username to "*****@*****.org.uk"
    set ftp_password to "****"
    set ftp_entire to ftp_username & ":" & ftp_password & " ftp://" & ftp_url
    set outPath to outputFolder & fileCounter & ".jpg"
    and then...
    do shell script ("curl -T --ftp-create-dirs " & outPath & " -u " & ftp_entire)
    Like I said, all works fine when the directories are already in place. I have permissions for the artists folder set to "777", i.e. writable. Because the script is trying to create two directories at once, i.e. "artistName2" and then "assets" under it, I wondered if this was significant, but then I tried with just one new directory, and still got the error.

  • How do I save PDF files by default to the folder of the source file?

    How do I save PDF files by default to the folder of the source file with Acrobat 9.0.0 Standard?

    I am not seeing that behaviour. If I right-click a link to a .pdf file, I get the file saved with the original filename.
    Maybe one of the settings in about:config controls that?
    pdfjs.previousHandler.preferredAction is a setting that has a value of 4 with my setup. I have no idea what that means, and I could not find any explanation anywhere. You could try using different numbers for that value and see if any make any difference. Why has nobody bothered to explain that setting anywhere?

  • Good day! When saving a file in Illustrator, I can not keep the older version. How You can save the file in an older version?

    Good day! When saving a file in Illustrator, I can not keep the older version. How You can save the file in an older version?

    When you save a file that's what options offers application
    05 мая 2014 г., в 13:40, Jacob Bugge <[email protected]> написал(а):
    sage go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click theStop Email Notifications link.

  • How do I save a file in the Dreamweaver CC folder on my computer's hard drive?

    Hi,
    I bought Dreamweaver CC.  I am trying to put a flash button in Dreamweaver that will like to another web site.
    The problem I am running into is when I try to save the flash button into my computer's Dreamweaver folder,
    I get a message saying "Contact your Administrator" because it won't save in that location.
    I know that I need to save it in the Dreamweaver folder so it has the same path so the flash button with a link will work.
    How do I save a file I want to put in a Dreamweaver page into my Dreamweaver CC folder?  I keep getting that
    contact your Administrator message.
    Please help,
    John

    Teacher of Students wrote:
    How do I save a file I want to put in a Dreamweaver page into my Dreamweaver CC folder? 
    John
    Honestly, you don't.
    DW is meant to be used with an individual "Local Root Folder" for each site you create with it. You should never have a reason to save into the DW program folders. Take a minute to go over creating a Site Definition in DW...
    http://tv.adobe.com/watch/learn-dreamweaver-cs5/gs01-defining-a-new-site/

  • How to save CSV file in application server while making infospoke

    How to save CSV file in application server to be used as destination while making infospoke.
    Please give the steps.........

    Hi
    If you want to load your flatfile from Application server,then you need to trasfer your file from your desktop(Computer) to Application server by using FTP.
    Try using ARCHIVFILE_CLIENT_TO_SERVER Function module.
    You Just need to give thesource path and the target path
    goto SE37 t-code , which is Function module screen, give the function name ARCHIVFILE_CLIENT_TO_SERVER, on click F8 Execute button.
    for path variable give the file path where it resides like C:\users\xxx\desktop\test.csv
    for target path give the directory path on Application server: /data/bi_data
    remember the directory in Server starts with /.
    U have to where to place the file.
    Otherwise use 3rd party tools to connect to ur appl server like : Core FTP and Absolute FTP in google.
    Otherwise...
    Goto the T.code AL11. From there, you can find the directories available in the Application Server.
    For example, if you wanna save the file in the directory "DIR_HOME", then you can find the path of the directories in the nearby column. With the help of this, you can specify the target path. Specify the target path with directory name followed by the filename with .CSV extension.
    Hope this helps
    regards
    gaurav

  • There is no 'Save as' under the file menu.  How do I save a file with another name?

    Numbers help refers to the 'Save As' function in the File menu.  My version (latest) does not have a 'Save As' function.  How do I save a file with another name?

    Ross Millard wrote:
    Badunit. You have an original file and an edited file. Now you duplicate the edited file and save it with a different name. Now do you have to go and delete the changed file from which the duplicate had been made? And.... is the original still unchaned... still original?
    Ross,
    For the situation you describe, Apple has provided Duplicate and Revert. Use File > Duplicate to reach this menu:
    Regards,
    Jerry

  • How do I save a file as an unformatted txt file instead of html or rtf?

    How do I save a file as an unformatted txt file instead of html or rtf?

    Use menu Image>Image Size in the image size dialog uncheck Resample and enter 300 in the resolution field and click OK.  Note no Pixels are changed only the resolution setting get changed.  The use Menu Fils>Save As in the save as dialog use the file type pull down and select Tiff then click Save
    In the Tiff Option Dialog in the Image Compression  section set None The click OK.

  • How do I save a file after getting an error in CS5?

    I was working on Adobe Photoshop CS5 on my 64bit Windows 7 when I got the following message:
    Adobe Photoshop CS5 has stopped working
    A problem caused the program to stop working correctly. Windows will close the program and notify you if the solution is available.
    How do a save the file before the program needs to close?
    Can I just close the Windows pop-up displaying the error, or will that also close the program?
    I have not saved the file in a while and I don't want to lose all the work I have done.
    Please help!

    By the time you see that error message, it is already too late.  Photoshop has already crashed.
    That's why the Auto Save feature in CS6 is so attractive,

  • How do I save the file after I have converted it from pdf to word

    HOW DO I SAVE A FILE AFTER I HAVE CONVERTED IT FROM PDF TO WORD

    Hi,
    After converting your file a box will appear on top of the window showing 'Download' option.
    When click on that your file will be downloaded and it will show the notification at the bottom.
    Click on arrow -> 'Show In Folder'.
    It will direct you to the location where your file has saved.
    Regards,
    Florence

  • In Pages how do I save a file with another name

    In Pages how do I save a file with another name?

    I don't know if there is a less cumbersome way to do this (I'm still pretty new to Lion) but This is what I do - since "Save As" seems to be gone with Lion.
    I create a duplicate document - then click the red button to close the document - and a dialog box pops up and asks if you want to save the changes - I change the name in there and then save the file under the new name.
    You can also save the copy to the desktop - get info - and then change the name if the finder window.
    I copied this from the Pages help area. These help instructions were created pre-Lion I'm sure.
    Saving a Copy of a Document
    If you want to make a copy of your document—to create a backup copy or multiple versions, for example—you can save the document using a different name or location. (You can also automate saving a backup version, as Automatically Saving a Backup Version of a Document describes.)
    To save a copy of a document: 
    Choose File > Save As and specify a name and location.
    The document with the new name remains open. To work with the previous version, choose File > Open Recent and choose the previous version from the submenu.

Maybe you are looking for