How to get file path from <cfinput type="file">
Hello all,
I am a newbie to ColdFusion and got stuck in an exercise.
I am having a form where the user picks a file.
<cfinput type='file' accept='.json' name="choosefile"><br>
<cfinput type="submit" name="loadData" value="Load JSON data">
</cfform>
Now i want to read the data from file upon submit.
<cfif isdefined("form.loadData")>
<cffile action="read" file="#form.choosefile# variable="jsondataFromFile">
<cfdump var="#jsondataFromFile#">
<cfif>
Now when i run the code i get FileNotFoundException because ColdFusion is searching for file chosen in temp directory.
How do i read the file?
Please help. Thanks in advance!
