• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Cffile or Cfinput file

Contributor ,
Aug 12, 2021 Aug 12, 2021

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.

 

Views

199

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Aug 19, 2021 Aug 19, 2021

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.

Votes

Translate

Translate
Advocate ,
Aug 12, 2021 Aug 12, 2021

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2021 Aug 12, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 13, 2021 Aug 13, 2021

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>

 

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 19, 2021 Aug 19, 2021

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2021 Aug 19, 2021

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation