INPUT TYPE="FILE" Ambiguity

liunx

Guest
Hi,<br />
<br />
When I use an input type="file" in my form, like so:<br />
<br />
<input type="file" name="filecontent"><br />
<br />
if I browse and submit an image file, like a .jpg or a .pdf, when the form submits to the action page, I output the value of form.filecontent, and it shows me the location of the uploaded file on the web server, and it will look something like this:<br />
<br />
FILECONTENT = C:\WINNT\TEMP\ACF46E.tmp<br />
<br />
That's good.<br />
<br />
However, if I browse and submit a file of type .htm or .html, and if I output the value of form.filecontent on the action page, instead of the location of the temp file on the server's c drive, i get the actual contents of the html file outputted instead. This won't work for me. I need the actual physical path to the uploaded file instead.<br />
<br />
Any ideas? You can test this problem yourself with a form like this:<br />
<br />
<FORM NAME="CONTENTFORM" ACTION="TextContentAction.cfm" METHOD="POST" ENCTYPE="multipart/form-data"><br />
<input type="file" name="FileContent"><br />
<input type="submit" name="submit" value="submit"><br />
</form><br />
<br />
...on the action page (TextContentAction.cfm) you will simply output the values of the form variables, to see what they look like. In Cold Fusion, you can use a <CFDUMP VAR="#FORM#">, for instance. In PHP you can loop through the form variables and output the $_HTTP['FileContent'].<br />
<br />
Try uploading a *.jpg file, and later try uploading a *.html file, you will see two different kinds of values for the form.FileContent<br />
<br />
Any help with this will be mucho appreciated<br />
<br />
Greg<!--content-->
 
Back
Top