Storing file name when uploading using Coldfusion

前端 未结 3 1756
遇见更好的自我
遇见更好的自我 2021-01-20 21:13

I am trying to store the filename of the selected file to be uploaded into a hidden input field on the form. my form looks like this

3条回答
  •  不知归路
    2021-01-20 21:39

    As lvmisooners said,

    GetPageContext().formScope().getUploadResource("myFormField").getName()
    

    works for Railo (and Lucee) but I noticed an interesting wrinkle: if the browser is IE than this returns the full source path including the filename. Firefox and Chrome on the other hand, return only the filename.

    For my application I need the full path, but haven't been able to find that if the browser is FireFox or Chrome. If anyone has any ideas I would be most grateful!

    (Sorry for not replying to lvmisooners but I don't have the reputation points to reply.)

提交回复
热议问题