Using cfhttp, copied file is appended and original is overwritten

I'm not sure if its the cfhttp configuration or if this is a problem with the webdav server configuration.
Here's my CF code:
  <cftry>
        <cfhttp  method="put" url="https://#Application.psupload.Webdavserver##Application.psupload.Filetxt#" username="clb39" password="5wimF1shco" throwonerror="yes" path="#Application.psupload.Pathtxt#" multipart="Yes" timeout="30000">
            <cfhttpparam type="file" name="#Application.psupload.Filetxt#" file="#Application.psupload.Pathtxt##Application.psupload.Filetxt#">
        </cfhttp>
        <cfset Application.psupload.msg="#Application.psupload.msg# Webdav Success<br>">
        <cfcatch>
            <cfset Application.psupload.msg="#Application.psupload.msg# Webdav Failure<br>">
        </cfcatch>
    </cftry>
It looks like a 'return code' that overwrites the original file:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>201 Created</title>
</head><body>
<h1>Created</h1>
<p>Resource /[removed]/Upload_1103080403.txt has been created.</p>
<hr />
<address>Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.7d DAV/2 Server at [removed] Port 8[removed]0</address>
</body></html>
The copied file is made correctly, but some how 4 lines are added, and the 3rd one has this string each time:
-------------------------------7d0d117230764--
Any thoughts? Is it cfhttp or Webdav?
TIA,
CB

The end result was bad coding. The proper format:
        <cfhttp  method="put" url="https://#Application.psupload.Webdavserver##Application.psupload.Filetxt#" username="*" password="**************" throwonerror="yes">
            <cfhttpparam type="file" name="#Application.psupload.Filetxt#" file="#Application.psupload.Pathtxt##Application.psupload.Filetxt#" mimetype="text/plain">
        </cfhttp>
The original code was wrong b/c:
path="#Application.psupload.Pathtxt#" - should be the return message path, ie log of transaction. By setting it equeal to the file to be copied, it gets overwritten.
I did run into an additional issue creating the export file with an extra carriage return and line being added to the end of the file - this was a problem with cfloop and was resolved by 2 cfloop statements to the file, first writing queryrecords-1 and second just writing the last record in query without a new line
Sample Code:
<cftry>
                <cfloop query="Pending" startrow="1" endrow="#(Pending.recordcount)-1#>
                    <cffile action="append"
                    file="#Application.psupload.Pathtxt##Application.psupload.Filetxt#"
                    output="#TRIM(UniqueAppID)#--- cut for clarity"                
                    addnewline="yes">
                </cfloop>
                <cfset Application.psupload.msg="#Application.psupload.msg# multi Local txt File populated sucessfully<br>">
                    <cftry>
                        <cfloop query="Pending" startrow="#pending.recordcount#" endrow="#pending.recordcount#">
                            <cffile action="append"
                                 file="#Application.psupload.Pathtxt##Application.psupload.Filetxt#"
                                 output="#TRIM(UniqueAppID)#-- cut for clarity"                
                                 addnewline="no">
                            </cfloop>
                        <cfset Application.psupload.msg="#Application.psupload.msg# multi Local txt File completed sucessfully<br>">
                            <cfcatch>
                                <cfset Application.psupload.msg="#Application.psupload.msg# multi Local txt File Last record Failed<BR>">
                            </cfcatch>
                    </cftry>
                <cfcatch>
                    <cfset Application.psupload.msg="#Application.psupload.msg# multi Local txt File population Failed<BR>">
                </cfcatch>
            </cftry>
Doing this mean I also need to control for when Pending has only 1 record, which other code handles.

Similar Messages

  • Using cfhttp to read a page and write its contents to a file.

    Hi,
    I am trying to get a feed of my ebay store listings to load
    into froogle. Unfortunately, ebay provides the feed as a website
    not a file and froogle (via GoogleBase) needs the file to be
    submitted as an XML file.
    Is there a way to use something like cfhttp to load up the
    page where the feed is located, scan the page and write it's
    contents into an XML file that I can then load up to GoogleBase???
    thanks for the help.

    ignore me now.... I answered my own question a short while
    ago.
    for anyone who cares....
    I used CFHTTP to get the page and then used a cffile to write
    the #cfhttp.filecontent# into the new file!

  • Copying files between Iphone and PC over 3G-connection?

    Hi,
    Is there any application for copying files between PC and Iphone using a 3G or Edge connection? I'm using Jaadu VNC client on my Iphone but it has no functions for file transfers (as far as I know).
    Thanks for any hints!

    No. I don't believe that would be allowed with the SDK. You could always email them to yourself.

  • I had formatted external HDD as Mac OS Extended(journaled) earlier, but now i want to format the same as ExFAT so that i can copy files between PC and MAC. But it is giving 'Can't unmount' error while i try to run Erase

    I had formatted external HDD as Mac OS Extended(journaled) earlier, but now i want to format the same as ExFAT so that i can copy files between PC and MAC. But it is giving 'Can't unmount' error while i try to run Erase

    Use the PC to reformat the drive.

  • Copy files over network and preserve original date modified/created

    This problem originally cropped up when importing photos into iphoto. I copied all my pics across the network and stored them locally then imported them into iPhoto. Problem was, any pics that did not have EXIF data were sorted by iPhoto, by date created...which was the date they were copied to the Mac.
    I got around that by trashing the iPhoto Library, then importing the photos over the network. The dates on the pics were correct on the Windows machine till the copy process changed them.
    is there a way to copy across the network and keep all the file attributes as they are on the original..An archive type feature.
    I had thought of RsyncX, but have not used that yet from within the Mac.
    Is there a way from within Finder to copy and keep attributes? or a third party app?
    Neil

    zip the folder with your pictures (control-click on it and choose "compress folder"), copy the zip files to the remote computer and unzip it there. this will preserve the modified and created dates.

  • How can I auto export a PDF File using the "Smallest File Size" preset and set the Exported File Name based on information from an Imported PDF?

    Greetings all,
    I am trying to create a script to automate a PDF export process for my company for inDesign. I’m fairly new to inDesign itself and have no previous experience with javascript, although I did take C++ in high school and have found it helpful in putting this code together.
    We have an inDesign template file and then use the Multi-page PDF importer script to import PDF files. We then have to export two version of each file that we import, then delete the imported file and all of the pages to reset the template. This has to be done for nearly 1000 pdf files each month and is quite tedious. I’m working on automating the process as much as possible. I’ve managed to piece together code that will cleanup the file much quicker and am now trying to automate the PDF exports themselves.
    The files are sent to us as “TRUGLY#####_Client” and need to be exported as “POP#####_Client_Date-Range_North/South.pdf”
    For example, TRUGLY12345_Client needs to be exported as POP12345_Client_Mar01-Mar31_North and POP12345_Client_Mar01-Mar31_South.
    There are two templates built into the template file for the north and south file that are toggled easily via layer visibility switches. I need to get a code that can ideally read the #s from the imported Trugly file as well as the Client and input those into variables to use when exporting. The date range is found in the same place in the top right of each pdf file. I am not sure if this can be read somehow or if it will have to be input manually. I can put North or South into the file name based on which template layer is visible.
    I am not sure how to go about doing this. I did find the following code for exporting to PDF with preset but it requires me to select a preset and then type the full file name. How can I set it to automatically use the “Smallest File Size” preset without prompting me to choose and then automatically input some or preferably all of the file name automatically? (If the entire filename is possible then I don’t even want a prompt to appear so it will be fully automated!)
    PDF Export Code (Originally from here: Simple PDF Export with Preset selection | IndiSnip [InDesign® Snippets]):
    var myPresets = app.pdfExportPresets.everyItem().name;
    myPresets.unshift("- Select Preset -");
    var myWin = new Window('dialog', 'PDF Export Presets');
    myWin.orientation = 'row';
    with(myWin){
        myWin.sText = add('statictext', undefined, 'Select PDF Export preset:');
        myWin.myPDFExport = add('dropdownlist',undefined,undefined,{items:myPresets});
        myWin.myPDFExport.selection = 0;
        myWin.btnOK = add('button', undefined, 'OK');
    myWin.center();
    var myWindow = myWin.show();
    if(myWindow == true && myWin.myPDFExport.selection.index != 0){
        var myPreset = app.pdfExportPresets.item(String(myWin.myPDFExport.selection));
        myFile = File(File.saveDialog("Save file with preset: " + myPreset.name,"PDF files: *.pdf"));
        if(myFile != null){
            app.activeDocument.exportFile(ExportFormat.PDF_TYPE, myFile, false, myPreset);
        }else{
            alert("No File selected");
    }else{
        alert("No PDF Preset selected");
    So far my code does the following:
    1) Runs the Multi-Page PDF Import Script
    2) Runs PDF Export Script Above
    3) Toggles the Template
    4) Runs #2 Again
    5) Deletes the imported PDF and all pages and toggles template again.
    It’s close and much better than the original process which was almost 100% manual but I’d like to remove the Preset prompt from the PDF script and have it automatically select the “Smallest File Size” preset. and then if there’s a way to have it auto-fill in the file name so no user input is required at all other than selecting each file to import. (If there’s a way to setup a batch action for the multi-import script that would be even better!)
    Thanks in advance and if there’s anything else I can provide that would help please let me know! Even a nudge in the right direction will be a big help!

    If you hold down the option key, it will typically show the location. Or you can often hit option-return on the file and it will reveal the file in the Finder, instead of opening it.
    Final option is to open it, and just option-click the filename in the toolbar of Preview and it should show you the location.
    It's probably an attachment to an email you've received. If you have Mail set to cache emails and their attachments it'll be stashed in a subdirectory of ~/Library/Mail. Which is fine.

  • Copying files between iPod and PC

    I have iTunes running on my G5, and I want to copy files from the iPod to my computer, is this possible? If not, then why not? It seems like an obvious option, yet my computer won't allow it. I'm quite angry about this, as I intended to use my iPod as a storage system anyway... this is frustrating me significantly.

    Do you mean files in general or songs from the iPod to iTunes? If you want to use it as a removable drive then enable it for disk use. When connected it will mount on the desktop and you can open it in Finder: Using your iPod as a storage drive
    If you want to transfer songs from it and you have any iTMS purchases, the transfer of purchased content from the iPod to authorised computers has been introduced with iTunes 7. A paragraph on it has been added to this article:: Transfer iTunes Store purchases using iPod
    The transfer of non iTMS content such as songs imported from CD is designed by default to be one way from iTunes to iPod. However there's a manual method of copying songs from your iPod to your Mac. The procedure is a bit involved but if you're interested it's available at this link: Two-way Street: Moving Music Off the iPod
    If you prefer something more automated there are a number of third party utilities that you can use to retrieve music files and playlists from your iPod, this is just a selection. I use Senuti but have a look at the web pages and documentation for the others too, you'll find that they have varying degrees of functionality and some will transfer movies, videos, photos and games as well. You can also read reviews of some of them here: Wired News - Rescue Your Stranded Tunes
    Senuti Mac Only
    iPodRip Mac Only
    PodWorks Mac Only
    PodView Mac Only
    iPodAccess Mac & Windows
    YamiPod Mac & Windows
    PodUtil Mac & Windows
    iPodCopy Mac & Windows

  • How can I copy file/folders from and to hard drives? How can I have two or more windows of explorer so that I can drag and drop from one hard drive to another?

    Hi,
    I am a new customer (purchased last week) of MacBookPro (latest) and its my first ever Apple laptop.
    I am almost lost to find the operating tools.
    1. How can I copy files from hard drive to computer and vis-a-versa?
    2. Only can browse one but how can I have two or more browses at the same time like in MS windows?
    3. No right click works on track pad?
    4. Is there application/ program compatible to MS office? If so how much and how can I purchase?
    5. Is there AutoCAD program that is compatible to MS Window AutoCAD? and if yes how much and how can I purchase?
    I will very much appreciate if you could email me the with the solution/answers please.
    Regards,
    Khagendra Limbu

    1) For some reason this happens once in a while with FAT32 enabled external harddrives. I have no idea why this happens but it most easily solved by reformatting the drive. First make sure you've copied everything from the external drive to your internal harddrive. You've done this earlier so I assume you know how to do this.
    Now the reformatting part. Open Finder and go to Applications. Look for the folder called "Utilities". Click on it. In it you find a program called "Disk Utility". Click on it. Now look for the external drive. You probably see two entries for the disk. Click on the one that contains the name of the drive NOT the one that describes the disk (Like for example 320.07 GB Samsung S2 Portable Media).
    Now you see four tabs in the righthand part of the window. They're called "First Aid", "Erase", "RAID" and "Restore". Click on "Erase". This opens the tab with (amongst others) a dropdownbox (Format) and a textbox (Name) . In the dropdownbox select "Mac OS Extended (Journaled). Take note! This selection disables usage of the drive with Windows PC's. If your goal is to share the drive with Windows PC's select the MS-DOS FAT option.
    Enter a label for the drive in the textbox Name. Now click on the button "Erase". This will format the drive.
    Now when it's done you can copy back all the items you've copied to your internal harddrive earlier.
    2) Opening two windows like Explorer on Windows is opening two Finder windows on the Mac. Simply click on the background. In the menubar you items like 'Finder", "File", "Edit", "View", et cetera. Click on "File" and "New Finder Window". Do this two times. Alternatively you can click on the background and press CMD-N two times.
    3) You can right click on the trackpad. This however depends on if you've enabled the feature in System Preferences. In the topmenubar click on the Apple icon and select "System Preferences". Now look for Trackpad in Hardware. Click on it. You see three tabs with the names "Point & Click", "Scroll & Zoom" and "More Gestures". Select "Point & Click" and look for "Secondary Click'. Make sure it is checked and make sure it has written "Click or tap with two fingers" written beneath "Secondary Click". When you're done exit System Preferences. Now select the background and tap with two fingers on the trackpad. This should open the contextuel menu with options like "New Folder", "Get Info" et cetera.

  • Using WindowsDV  .avi files in iMovie and iDVD

    I'm about to buy a Mac after using PCs for many years. I'm still deciding whether to buy an iMac 20", upgrade the Ram and use an external firewire drive or to get a Mac Pro and use internal drives. Initially I'll use iMovie and iDVD and I have some questions regarding using files I've already created on my PC. Up until now I've mainly been using Ulead Video Studio 10 and Ulead DVD Workshop. DVD Workshop does not do 16:9 menus and has now been discontinued and I've been impressed with iMovie and iDVD when I've seen it in Apple stores.
    I have some unedited 16:9 .avi files that I've captured from my Panasonic GS-400 camcorder as well as some already edited .avi and .mpg files. Will iMovie and iDVD recognise .avi DV files when accessed through my network or copied onto the Mac hard drive? I'll load unedited clips into iMovie for editing but anything that's already edited I'd like to put straight into iDVD, add chapters and make a menu etc.
    Is this going to work easily or will I have to convert the files to an apple compatible format?
    Thanks for any advice you can offer.
    Ken
      Windows XP Pro  

    Hi Ken and welcome to Apple!
    You should not have a major problem. The AVI files should (repeat should) be recognized by iMovie. If not, conversion should (I love the certainty of that word!) be easy.
    An iMac will do all you ask, but I recommend not less that 1GB of RAM.
    At this stage, go get your iMac, and try to import the AVI files into iMovie. If that is not successful post back!
    Remember: iMovie expects to be 'fed' by digital video through a firewire connection.
    Any more questions, we are here to help!

  • Use of href="file:///... and href="afp:// links

    Mac OSX Server Apache and Safari 6.03 on Mountain Lion iMacs. I've got a simple .html file being served up by apache that has an <a href="file:///... link to a file outside the webserver root. From what we're seeing and researching, for security reasons, Safari ignores file:/// links when it's served up in an .html page. (Safari does open the file:/// if you use the File-->Open command.) Question - is there any way to have the link in the .html page and have Safari open that file ??? The closest I've come is to put a <a href="afp://... link to the file. Safari then opens a Finder window. 

    You can Oralce administration guide,
    Database Administrator Authentication
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/dba.htm#i1006534

  • How to use ODI tool (file move etc) and plsql in a ODI procdure step

    Hi,
    I need your help to uses both plsql code and ODI tolls in a ODI procedure step.
    Req:
    moving files to different directory Based on the variable value and previous step return code ,
    BEGIN
    IF #SEQ=1 AND <%=odiRef.getPrevStepLog("RC")%> =0
    then OdiFileMove "-FILE=input/#FILE_NAME" "-TOFILE=processed/#V_FILE_NAME" "-OVERWRITE=YES" "-CASESENS=NO" "-RECURSE=YES"
    ELSIF #SEQ=1 AND <%=odiRef.getPrevStepLog("RC")%> !=0
    then OdiFileMove "-FILE=input/#FILE_NAME" "-TOFILE=reject/#V_FILE_NAME" "-OVERWRITE=YES" "-CASESENS=NO" "-RECURSE=YES"
    END IF;
    END ;
    how do I do that ? which technology I have to use because for plsql I need oracle and ODI file move I need sunopsis
    Please help me.
    Thanks,

    Hello User,
    Use below code, it will work fine.
    Technology: OdiTools
    <@if((<%=odiRef.getPrevStepLog("RC")%>)>0 && #PROJ_FILE.SEQ==1){@>
    OdiFileMove "-FILE=input/#FILE_NAME" "-TOFILE=processed/#V_FILE_NAME" "-OVERWRITE=YES" "-CASESENS=NO" "-RECURSE=YES"
    <@}else if ((<%=odiRef.getPrevStepLog("RC")%>)>0 && #PROJ_FILE.SEQ==1){@>
    OdiFileMove "-FILE=input/#FILE_NAME" "-TOFILE=reject/#V_FILE_NAME" "-OVERWRITE=YES" "-CASESENS=NO" "-RECURSE=YES"
    <@}@>
    Thank You.

  • Preparing to copy files 12,300(and counting),press stop.is anything copied?

    Hey Forum,
    I accidentally copied a 80gb folder from my ext. hdd onto my desktop, i only realised it when it is preparing 12,300 files(n counting). so i pressed stop. is anything copied? Am i being paranoid that something is copied? or that i am just paranoid, nothing is copied. please help, thanks!
    Regards
    Ala.
    please help thanks!

    i accidentally drag it into 'Volumes". which i cannot find where the folder'
    volumes' is. so do u know where the folder ' volumes' is?
    /Volumes is at the top level of your startup drive - it is "hidden" from Finder, but it's easy to peek into it:
    Finder > Go Menu > Go to Folder
    enter /Volumes and click Go
    That folder contains the "mount points" for all mounted volumes, and such mount points will have "alias" icons (with a little curved arrow). So don't touch anything there that looks like an alias!

  • Can i use one copy on my iMac and my MacBook.  I do not use the computes at the same time just in different locations

    Can I use on cooy of Acrobat on my iMac and on my MacBook. The computers are in different locations?

    i am in acrobat  or so it says!  Thanks for the reply.

  • Upload and Copy files using PLSQL.

    Hi All,
    Can UTL package can be used to upload any local data file to server?
    Or is there any in-built package which can be used to upload files to servers and copy files to another directory?
    Thanks in advance.

    Avishek wrote:
    Thanks.
    But i've a requirement to upload and copy files from one directory to another.
    How can i approach?Realize we only know what you post & so far you have posted NOTHING useful.
    How exactly does end user interact with the DB?
    3-tier application?
    EndUser<=>browser<=>WebServer<=>ApplicationServer<=>DatabaseServer
    What OS name & version for client system?
    Handle:      Avishek
    Email:      [email protected]
    Status Level:      Newbie (5)
    Registered:      Jun 3, 2008
    Total Posts:      68
    Total Questions:      27 (16 unresolved)

  • Help required in using same excel file as both Input and Output source

    Hello Programmers, Here I am trying to read, modify and write an excel file using JAVA, I have successfully employed Jakarta POI and read the file but the problem is that I can''t make changes in the same file and save it.
    I can't use the same file for "FileInputStream" and "FileOutputStream" I think this is causing major hurdle. Any kind of suggestion and help is truly appreciated and welcome. Thank you for your time. Here I am posting my code its a bit crude please pardon.
    * @(#)attempt4.java
    * attempt4
    * @author
    * @version 1.00 2008/3/26
    import java.io.*;
    import java.util.*;
    import org.apache.poi.poifs.filesystem.*;
    import org.apache.poi.hssf.usermodel.*;
    public class attempt4 {
    public static void main(String[] args) {
    try{
    File xlFile = new File("C:\\Drifter\\Study\\Krishnan\\Test.xls");
    FileInputStream readFile = new FileInputStream(xlFile);
    POIFSFileSystem fileSys = new POIFSFileSystem(readFile);
    HSSFWorkbook xlSheetBook = new HSSFWorkbook(fileSys);
    for(int i = 0; i < xlSheetBook.getNumberOfSheets(); i++) {
    HSSFSheet sheetNow = xlSheetBook.getSheetAt(i);
    System.out.println("\n Now Opening Sheet Number" + (i+1));
    if(sheetNow.getPhysicalNumberOfRows() > 0) {
    int numOfRows = sheetNow.getLastRowNum();
    int numOfColumns = 0;
    for(int cols = 0; cols < numOfRows; cols++) {
    HSSFRow rowNow = sheetNow.getRow(cols);
    if(rowNow != null) {
    if(numOfColumns < sheetNow.getRow(cols).getLastCellNum()) {
    numOfColumns = sheetNow.getRow(cols).getLastCellNum();
    System.out.println("\n There are " + (numOfRows+1) + " Number of Rows");
    System.out.println("\n There are " + numOfColumns + " Number of Columns");
    for(int j = 0; j < numOfColumns; j++) {
    float colTotal = 0;
    int numOfNumericCells = 0;
    for(int k = 0; k < numOfRows; k++) {
    HSSFRow rowReading = sheetNow.getRow(k);
    if(rowReading != null) {
    HSSFCell cellReading = rowReading.getCell((short)j);
    if(cellReading != null) {
    if(cellReading.getCellType() == 0) {
    colTotal += cellReading.getNumericCellValue();
    numOfNumericCells ++;
    else if(cellReading.getCellType() != 0) {
    cellReading.setCellValue((double) 0.00);
    System.out.println(" \nSum of Column " + (j+1) + " is " + colTotal);
    System.out.println(" \nAverage of Column " + (j+1) + " is " + (colTotal/numOfNumericCells));
    readFile.close();
    catch(FileNotFoundException ex1) {
    ex1.printStackTrace();
    catch(IOException ex2) {
    ex2.printStackTrace();
    catch(NullPointerException ex3) {
    ex3.printStackTrace();
    The above code can successfully read the excel document and caliculates the sum and averages of the columns, can any one please help me in writing the same into the same file in additional rows. Thank you very much for your time.

    May be you can try to create a temporary copy of the file, do your update on it and then overwrite the original.
    Edited by: jgagarin on Jun 3, 2008 6:55 PM

Maybe you are looking for

  • Account Assignment in an automatic PO created from a goods receipt idoc

    Hi guys, I'm doing a goods receipt via the IDOC MBGMCR that is automatically creating a PO.  Is there a way to make the item on that PO using the account assignement "K" (Cost Center) ? In the BAPI for the goods movement, they are calling the functio

  • Transferring Voicemail and Locked texts from Samsung Alias 2 to iPhone 5

    I am about to upgrade from a samsung alias 2 to an iPhone 5 and want to transfer voicemails and locked text messages over.  Can anyone help me figure out how to do this? Thanks

  • How to embed placeholder from report layout editor in a link

    I have created a report selecting the custom report layout option. Rather than using a link on the column, I would like to add different links in the footer section in the Report Layout Editor. My problem is trying to create a link and pass a value f

  • What is the validity of Oracle SQL 1ZO-007 certification?

    Hi, I have done Oracle SQL 1ZO-007 certification in May 2006. However, I could not write the next level, PL/SQL 1ZO-047. Now I am planning to write it. My doubt is whether my SQL certification is till valid so that upon clearing 1ZO-047 I can get OCA

  • No warning message triggered for VP

    Hi, I need help from the experts. I have set tolerance limit for VP at SPRO > Materials Management > Inventory Management and Physical Inventory > Goods Receipt > Set Tolerance Limits I have also changed the system messages at SPRO > Materials Manage