In Coldfusion, using cffile upload, when a file is selected with the browse button the name of the selected file shows next to the button. So far, so good. When I submit the file for upload, the text changes back to "no file selected". This is doubtless because we are submitting a form.
However, I'm submitting the form to the same page, and would like to see the name of the file selected instead of "no file selected" which is likely to confuse the user.
The code:
<form
enctype="multipart/form-data"
method ="post"
name ="attupload"
action ="">
<cfoutput>
<table style = "margin-left: 40%">
<tr><td>
<input name="theupload"
type="file"
style = "font-family: comic sans ms;
color: ##679C9C">
</td></tr>
</table>
<div style = "width:20%; margin:5% auto 5% 45%">
<input name = "submit"
type = "submit"
class = "submitbut"
style = "font-size: 16px"
value = "Upload File">
</div>
</cfoutput>
</form>
The words 'no file selected' seem to be part of the input name = 'upload' field, but ColdFusion evidently takes control of it, and I cannot insert anything else.
Does anyone know how I can control the 'no file selected' note, so that I can put the name of the selected file back in that spot? I have tried with javascript, but it is simply ignored.
question from:
https://stackoverflow.com/questions/66054972/coldfusion-cffile-upload-replace-no-file-selected 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…