Script function for file upload in ColdFusion 9

后端 未结 3 1384
無奈伤痛
無奈伤痛 2021-01-18 21:03

Is there a a cfscript equivalent for cffile action=\"upload\" in ColdFusion 9? Looking through the docs, there doesn\'t seem to be.

[Update] This was added in the 9

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-18 21:14

    You can easily abstract it with a user defined function.

    
        
        
        
        
    
        
    
        
    
    

    And then use it in cfscript:

    
        // NOTE: because of how cffile works, put the form field with the file in quotes.
        result = fileUploader("FORM.myfield", myDestPath);
        WriteOutput(result.fileWasSaved);
    
    

    Note: I would be very careful how you rename this function in case Adobe does include this functionality down the road.

提交回复
热议问题