Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFFILE question

Status
Not open for further replies.

kafka

Programmer
Oct 17, 2000
27
0
0
US
There are two parts to my question:
I have a form that allows for multiple image uploads.


What I want to do is to be able to insert the path of the image to a field in my database.
Right now I can upload the actual image to a particular designated place on my server.
I need to know where that image is located, and in order for me to know that I need a
way to insert that path to my field.

The other part to my question is that would it be possible to generate a sheet providing
information about the uploaded image and then send the contents of that information file
to a a file on my server. For example when the file is uploaded to c:\upload\image an
file is also sent to that path proving information like the server path, image type, user
first name, user last name associated with the image. Without some kind of information
abou the image uploaded, the image is useless because i don't know what use has uploaded
the image.

Anyone have any suggestions?




This is my processing page for my Form.

<CFINSERT DATASOURCE = &quot;mhdinternal&quot; TABLENAME=&quot;driver&quot;
FORMFIELDS = &quot;badgeno,licenseno,licenseissue, .......>

<CFINSERT DATASOURCE = &quot;mhdinternal&quot; TABLENAME=&quot;Driver_vehicle&quot;
FORMFIELDS = &quot;licenseno, mot, type, refrigerated, vreg, vsurname, etc.....>



<CFIF ISDEFINED(&quot;Form.licensephoto1&quot;)>
<CFIF Trim(Form.licensephoto1) IS NOT &quot;&quot;>
<CFFILE ACTION=&quot;Upload&quot;
FILEFIELD=&quot;licensephoto1&quot;
DESTINATION=&quot;c:\web\upload\licensephoto&quot;
ACCEPT=&quot;image/jpg, image/pjpeg,image/gif,image/bmp, image/tiff&quot;
NAMECONFLICT=&quot;OVERWRITE&quot;>
</cfif>
</cfif>


<CFIF ISDEFINED(&quot;Form.driverphoto1&quot;)>
<CFIF Trim(Form.driverphoto1) IS NOT &quot;&quot;>
<CFFILE ACTION=&quot;Upload&quot;
FILEFIELD=&quot;driverphoto1&quot;
DESTINATION=&quot;c:\web\upload\driverphoto&quot;
ACCEPT=&quot;image/jpg, image/pjpeg,image/gif,image/bmp, image/tiff&quot;
NAMECONFLICT=&quot;OVERWRITE&quot;>
</cfif>
</cfif>

 
There are many variables returned by the CFFILE tag that give pretty specific information. Check out the help section under CFFILE ACTION=&quot;Upload&quot;.

Why not just insert the name of the file into the database record where you're storing everything else? Since you specify a path to upload the file to you should also know the relative path that your pages would use. For example, if your upload path was c:\web\myweb\images, myphoto.gif would probably have a relative path/filename of /images/myphoto.gif. Simply insert a field in the database as ex. Photo = 'images/#FILE.ServerFile#.#File.ServerFileExt#. This also allows you to set NAMECONFLICT=&quot;MAKEUNIQUE&quot; instead of NAMECONFLICT=&quot;OVERWRITE&quot; since CF returns the name it was saved as.

I don't really know exactly what you're trying to do but I hope this helps!

Andrew
amayer@sonic.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top