Copy link to clipboard
Copied
Bonjour,
Ma question est simple :
Quand, pour la première fois, je vais chercher un fichier :
<CFINPUT type="file" action = "upload" name="Aut_photo" value="" size="50" accept="image/jpg, image/jpeg, image/gif"><br>
Pas de problème ! cela affiche, à côté du bouton "Parcourir", le nom du fichier !
Par contre, quand je veux consulter cette donnée à nouveau :
<CFINPUT type="file" action ="read" name="Aut_photo" value="/../../#session.site#/_Editeurs/#get_clients.Societe#/#MajAuteurs.Aut_Nom#/Auteur/#MajAuteurs.Aut_photo#">
Je n'ai plus aucune trace de ce dernier. J'ai le bouton "Parcourir" et la mention "Aucun fichier selectionné".
Merci d'avance pour votre aide.
Hello,
My question is simple:
When, for the first time, I go to look for a file:
<CFINPUT type = "file" action = "upload" name = "Aut_photo" value = "" size = "50" accept = "image / jpg, image / jpeg, image / gif"> <br>
No problem ! this displays, next to the "Browse" button, the name of the file!
On the other hand, when I want to consult this data again:
<CFINPUT type = "file" action = "read" name = "Aut_photo" value = "/../../# session.site # / _ Editors / # get_clients.Societe # / # MajAuteurs.Aut_Name # / Author / # ShiftAuthors.Aut_photo # ">
I no longer have any trace of the latter. I have the "Browse" button and the mention "No file selected".
Thank you in advance for your help.
Bonjour,
C'est une excellente solution (pas facile !).
Merci pour votre réponse.
Hello,
This is an excellent solution (not easy!).
thank you for your reply.
Copy link to clipboard
Copied
This is an HTML restriction.
You cannot provide a value to the "input" element with a type of "file".
The cfinput tag wraps the "input" HTML element.
Copy link to clipboard
Copied
You cannot, for security. See for example
https://stackoverflow.com/questions/1696877/how-to-set-a-value-to-a-file-input-in-html
Copy link to clipboard
Copied
There is an alternative, which enables you to "programmatically" pass the value of the file path. You will need 2 CFM files:
<!--- uploadFile.cfm --->
<cfset filePath="C:\Users\BKBK\Desktop\dcba.pdf">
<cfhttp url="http://localhost:8500/uploadIt.cfm" method="post" multipart="true">
<cfhttpparam type="file" name="fileContent" file="#filePath#" >
</cfhttp>
<!--- uploadIt.cfm --->
<cfif isDefined("form.fileContent") >
<!--- If TRUE, upload the file. --->
<cffile action = "upload"
fileField = "fileContent"
destination = "c:\uploads\"
nameConflict = "overwrite" >
</cfif>
Copy link to clipboard
Copied
Bonjour,
C'est une excellente solution (pas facile !).
Merci pour votre réponse.
Hello,
This is an excellent solution (not easy!).
thank you for your reply.
Copy link to clipboard
Copied
It remains unclear which solution you refer to. Please mark the solution that you consider correct; it can of course be your own.
Such information will help someone else who comes here with the same problem.