>>Can you be a little more explicit about how you do that, Claude?
I've never used CreateUUID before.

I rename the file when it is uploaded. Ie:
<CFSET fileName = "#CreateUUID()#.temp">
<CFIF fileUpload NEQ "">
    <!--- File received --->
    <CFFILE ACTION="Upload"
       FILEFIELD="#fileUpload#"
    DESTINATION="#Path#"
    NAMECONFLICT="MakeUnique">
    <CFFILE ACTION="rename"
      SOURCE="#Path##CFFile.ServerFile#"
      DESTINATION="#fileName#">
....
Then I analyse the true file type:
    <CFX_IMAGE ACTION="READ" FILE="#Path##FileName#">
    <CFIF isDefined ("img_type") AND img_type NEQ "" AND "jpeggifpng" 
CONTAINS img_type>
        <CFSET fileNewName = listFirst(fileName, ".") & "." & img_type>
    <CFELSE>
      <H3>The file uploaded does not contain a valid image...</H3>
      <CFABORT>
....
Then I either reduce the image, either just rename the file
    <CFIF max_width GT 0 AND img_width GT max_width>
        <!--- Reduce image and rename the file --->
        <CFX_IMAGECR3
            GETIMAGEINFO
            LOAD="#path##fileName#"
            RESIZE="#max_width#x"
            SAVE="#Path##FileNewName#">
            <!--- Delete the temporary file --->
            <CFFILE ACTION="delete"    FILE="#Path##FileName#">
        <CFSET width = IMAGECR.width>
        <CFSET height = IMAGECR.height>
        <CFSET fileSize = IMAGECR.filesize>
    <CFELSE>
            <!--- no resize: just rename the file --->
        <CFSET width = img_width>
        <CFSET height = img_height>
        <CFSET fileSize = img_size>
        <CFFILE ACTION="rename"
           SOURCE="#Path##FileName#"
        DESTINATION="#fileNewName#">
    </CFIF>
Then register the file in the database...

-- 
_______________________________________
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to this address: [EMAIL PROTECTED])
Thanks.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305462
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to