Is there an easy way to run an Ajax function from input type=file to test the file name in DB?

I've had the <input type="file">  ... <cffile ...> thing going for a few years now. 
There is a database where the uploaded file names are stored once the files are uploaded to the server.  It sees things in terms of problems and stores uploaded file name accordingly with the ProbID prepended onto the file name; e.g., MyPicture.jpg would end up in the designated directory and databawe as P416_MyPicture.jpg.  This allows user to store pictures with the same name in different problems without a conflict.  There has been an issue with certain characters (e.g., spaces, +, #, etc.) causing problems when they are in file names so we have come up with a way using the <cffile ... rename> to replace these chars with _.  This means that MyPic+.jpg would end up being P416_MyPic_.jpg. 
     This is where the problem appears.  If someone were to upload MyPic+.jpg after someone else uploaded MyPic_.jpg in the same problem, then the + file would overwrite the _ file before the system knew they had a problem.  And there is now way to restore the original file without going to the system backup and doing so – which is a whole other story … especially, if the person doesn’t tell anyone.
     The logical solution would be to be able to test the new final file name (the name after making the substitutions mentioned above) against the existing files in the database before you went from the page where the <input type=file> control to the associated _action.cfm page where the <cffile> object is located.  Given that this seems to be the province of Ajax, this would seem like a natural use of the really interesting technology.  I have can determine the file name from the onChange action on the <input type=File> so that this would be the place for Ajax to come to the rescue by looking up the final file name and then letting the user know whether the resultant name is a unique within the database or not.  If so, I'll just enable the Add button which sets right next to the <input > control and let them upload it.  If not, I'll put up an error message telling them that this file already exists in the system.
     This would be the perfect solution.  It would let me do some Ajax stuff like I've wanted to do for the past year, but never have had the time to do because this is the project that won't go away.  This is, in fact, the last thing of any consequence that remains to do on this 2-1/2 year nightmare – be careful what you wish for.  If I can get this done this week, then maybe I can finally take a weekend off … maybe it will finally come to an end.
     Which finally leads to my question:  I'm looking for some tips on how to get this thing going since I can barely spell Ajax.  I've got a book and looked at some stuff online about CF and Ajax, but a good example or two or three would be worth a day's worth of poking around on the web and in my books.
     Thanks in advance for any suggestions, ideas, help, whatever.
Len

Adam,
     Thank you for your suggestion, but, after spending the night working with Ben Forta's CF8, vol 2, Chap 34, working with <cfajaxproxy>, I was able to do exactly what I wanted and it appears, after some testing, to work exactly as I had envisoned it should. 
     I am now calling a JavaScript function (testFileName) from the onChage event on the <input type="file"> or Browse button, which calls my proxy.cfc that contains the server side of the equation.  This funciton testFileName (I've run out of cleaver function/file names).  The query contained therein hits the database to see if the passed in parameters can pull up an existing file.  If they do, the particulars (file name, data attahced, etc.) are returned to the JavaScipt procedure that puts up the error notice.  The user can then chose to either overwrite the file or quit.  Quiting leaves the your on the Attachment PopUp where he/she started with nothing being uploaded. 
     Thanks again for your suggestion.  I appreciate your taking the time to do so.
Len

Similar Messages

  • Is there an easy way to move contacts and calander from my office microsoft outlook to personal imac?

    is there an easy way to move contacts and calander from my office microsoft outlook to my personal imac?

    You can import the clips in the order you want them to play, which would be the quickest.
    Or you can put them all in the timeline, then zoom out on the timeline (two finger squeeze).
    That makes it easier to hold the clip, and drag it to the start.
    http://help.apple.com/imovie/ipad/1.2/index.html

  • Is there an easy way to create an excel list from my contacts?

    I am doing a web-marketing and I want to use my contacts in my contact list. Is there an easy way to download my contacts into an excel list format?

    Using Automator, you can export some of the infoemation to a tab delimited file which Excel can open.
    Re: Drag and drop from Contacts into Numbers not working - any solutions?
    https://discussions.apple.com/message/22309780#22309780#22309780
    You can drag a selection of contacts into Numbers and it will grab a little of the Info, putting it in columns.

  • Is there an easy way to use MOVE when importing from card reader?

    In Lightroom 1, I would hit File -> Import From Disk which would allow me to move photos from my card reader to the hard drive.
    In Lightroom 3, the only option is the normal import dialog and in order to get the "Move" option I have to select "other source" and then scroll down the list to select the card reader in order to get the "Move" option.  It's a pain to do it every time.  (not to mention my wife will never do it and just use "copy").
    So my question is, "Is there a way to get the Move option to be available by default on my card reader?"
    It's been my workflow since 2004 to have the images deleted directly after I copy them off the memory card using Adobe software (Photoshop Album 2.0, Photoshop Elements 4, Lightroom 1.0).  I'm really hoping there is an easy way to accomplish this in Lightroom 3. Otherwise I will be pretty disappointed.

    function(){return A.apply(null,[this].concat($A(arguments)))}
    brianbjork wrote:
    The reason I like the move command so much is that I know when photos are on my memory cards that the are not on my computer.
    LR defaults to not importing suspected duplicates.  so if there are still files on the card, they will be grayed out. That's how you can know.
    function(){return A.apply(null,[this].concat($A(arguments)))}
    brianbjork wrote:
    What do you all use in your work flow to delete the pictures left on your memory cards after they are copied?
    I have a shell file that removes the files from the card and ejects the disk.  I keep it in my dock for easy access.
    Others will tell yiou, though, to format in camera. Which is a good idea! I just like to keep my cards empty and ready.

  • On my old macbook (osx 10.6.8), is there an easy way to clone my new SSD HD before installation?  I have the cable connector for the new SSD to the USB port

    My Macbook, 2007 vintage with osx 10.6.8 and an 80GB original HD is going to get a new brain....a 240 GB HD.  I have the USB cable to connect the new HD to the laptop before swap of the drives.  Is there an easy way to transfer the appropriate info from the old HD to the new SSD before the hardware swap?  Where is the procedure?.....I have a backup plan to use my external backup drive to do this but that would seem rather cumbersome.....Recommendations???

    Both of these applications can be used to create a clone.
    SuperDuper! http://www.shirt-pocket.com/
    CCC http://www.bombich.com/download.html

  • Is there an easy way to switch between ehternet and wifi connection without having to disconnect the ethernet cable?

    Hi All
    Was wondering if there is an easy way to switch between ethernet and wifi connection on Apple TV without having to disconnect the ethernet cable. The reason I ask is that I find it quicker to use my ethernet connection via a Netgear Powerline Home Theatre Set-up to stream Trailers and Movies on the Apple TV, however this is no good when connecting directly to my Mac to stream music or TV shows in iTunes, so revert to the wifi connection that I created on my Time Capsule to do this.
    Would be handy if Apple TV had a menu option where you could manually change the connection type depending on what you were doing, as per above scenario.
    Cheers
    Brett

    brettfromseabrook wrote:
    Hi All
    Was wondering if there is an easy way to switch between ethernet and wifi connection on Apple TV without having to disconnect the ethernet cable.
    Unfortunately not.

  • Is there an easy way of creating a distribution list from an email with multiple addresses? Those addresses are not in your contacts already, and don't need to be.

    I want to be able to take all the email addresses someone else has used to distribute an email and create the same distribution list for myself for future use.  I don't want to add all those people to anywhere in my contacts list.  I just want them to be in my "new distribution list", like "soccer families", etc.  I tried to copy and paste, but didn't get anywhere. Maybe I was close, or maybe it isn't possible.  Thoughts?

    Ed on iPad wrote:
    I don't want them in contacts because they are simply a related group (like my sons current soccer team).  People I may never need to email again after a sports season.  I don't want to have to have these people in my contacts permanently. 
    You don't. When the season is over, delete them.
    But, the text clipping should work.
    The next IOS should have a feature "create mailing list from distribution list".  A fast and simple way to retain a distribution list from an email you received.  People get copied all the time using distribution lists they may want to reuse easily, like school, sports or work groups.  Oh well.
    How is that any different from adding them to Contacts? Here's the feedback page: http://www.apple.com/feedback/
    There is a set of Mail Scripts that has a function to Add Addresses from an email to any group. But, it doesn't work with Mountain Lion.

  • Is there an easy way to call a java class from an applet?

    Does anyone know of an easy way to call a server based java class from an applet? Has anyone done it or came across it? If yes how/where?
    Cheers, Chris.

    I'm not sure about the issue. Are you talking about "servelets"? "RMI"? Take a look at those issues.

  • HT201328 Is there an easy way to release my IPhone 3 from the "recovery" mode.

    Looking for an easy way to unlock this phone.  I have had apple products for about 5 years and have never had this issue.

    Please define "unlock". If it's in recovery mode, it needs to be restored.
    If it is carrier locked and you are trying to get it unlocked so you can use it with a different carrier, ONLY the carrier it is locked to can legally authorize that.

  • Is there an easy way inside PS CS4 to go from psd format to jpg?

    I'm working within PS CS4 on a psd file.  Any easy way within PS to transform that file into jpg format? Thanks for your interest! SNL

    OK, if jpg is not listed in the file type drop down box, then odds are you are in a mode that jpg does not support. Jpg is 8-bit
    In newer versions of photoshop this has been partially fixed as photoshop will convert a 16 bit image to 8 bit for you. But does not alter a 32 bit image, as it does not know how you want the image to be displayed.
    You can see what mode photoshop is in by looking at the tab at the top of the document window.

  • Is there an easy way to transfer data to Imac from windows

    Ihave exported data files(Quicken) to a flash drive.  When I plug it into my Imac I can see the files but not able to highlight them.

    No I cannot,  Ihave one file able to be moved (addresses) nothing else on tje drive can be moved

  • Is there an easier way to see all my texts from one friend?  The harder way is just clicking "see more messages" over and over again on the iPhone.

    Hi Everyone!
    I would like to be able to see (and possibly print out) all the texts that I have exchanged with one of my contacts.  Right now, I only know how to see the older texts by clicking "see more messages" every time I want to go back further in our history. 
    Thanks for reading my issue!
    Lori

    If a password is filled then that can only be done if the password is saved in the password manager.<br />
    If only the name is filled then that can be done by form fill.
    *Form History Control: https://addons.mozilla.org/firefox/addon/form-history-control/

  • Recently got a new iphone but when i tried to sync it with my itunes, all my music appeared with a cloud beside it and doesnt play. Do i have to download each individual track by clicking on each cloud or is there an easier way? I have over 1000 songs!!!!

    Recently got a new iphone but when i tried to sync it with my itunes, all my music appeared with a cloud beside it and doesnt play. Do i have to download each individual track by clicking on each cloud or is there an easier way? I have over 1000 songs!!!!

    Hi. The two user tips both describe a sequence of steps that should get your library from the point where it threatens to wipe data from your device to where it is syncing normally, while recovering as much information as possible. It may still be necessary to wipe and reload the device but this should only take place once all the data that can be recovered has been recovered.
    Doing step 1 of 8 and then complaining things aren't the way you want them to be yet strikes me as premature...
    Since you appear to have all your media content, and we are discussing an iPod classic, not an iOS device, the main worries are already taken care of. What's left is ratings, playcounts, playlist membership and checked status. Since your device holds only part of your library at best you could only recover the missing data for the content that is on the device using third party tools.
    Recreating the previous checked/unchecked status of every track in your library from where you are now may not be that easy. Syncing with selected playlists has many advantages, one of which would have been that you would have a named playlist that could have been retrieved by 3rd party software if you had used this method.
    You haven't explained what caused your problem in the first place, but if you have a Previous iTunes Libraries folder holding old copies of your iTunes database (generated with each iTunes update) then it would be possible to restore the most recent of these and then update the library with any changes in your media folder.
    BTW Apple doesn't offer free support for this kind of issue with iTunes.
    tt2

  • Is there an easy way to remove duplicates in my library?

    Hi there, since I first started using my ipod, I've had a new laptop. Having finally figured out (with your help!) how to move the songs from my ipod to the library on my new laptop, I did the transfer but it's duplicated loads of the tracks.
    Is there an easy way to remove them/stop that from happening?
    Any suggestions? Ta Legs xxx

    You'll find a script here.
    http://home.comcast.net/~teridon73/itunesscripts/index.html

  • I have a new computer and want to sync my Iphone and Ipad2 to the new computer, is there an easy way to do this?

    I have a new computer and want to sync my Iphone and Ipad2 to the new computer (PC) instead of the old one, is there an easy way to do this?

    Extract from one of our senior participant.
    Syncing with new computer
    1) Without connecting your iPad to your laptop, start iTunes. Click on Edit. Click on Preferences. Click on Devices. Check the box next to "Prevent your iPod etc. from automatically syncing." Click OK.
    2) Now connect your iPad to your laptop and start iTunes.
    3) When iTunes starts, right click on your iPad under Devices in the left column. Select Transfer purchases etc.
    4) After it finishes transferring all your apps to your new laptop, right click on your iPad and select Backup your iPad.
    5) After it finishes backing up your iPad, right click on your iPad and select Restore etc.
    6) After it finishes restoring, left click on your iPad , then click on the Apps tab on top, and check the box next to Sync Apps, then click on Apply below.
    If everything on your iPad looks good after the sync, go back and click on Edit / Preferences / Devices and UN-check the box next to Prevent your iPod etc. The only other thing you may want to check is if your contacts, bookmarks, etc. are syncing correctly now. If not, go to the Info tab after connecting and make sure you indicate which features you want to sync with what sources.

Maybe you are looking for