ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 10th, 2005, 01:08 AM
venkatgill venkatgill is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 9 venkatgill User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
problem with cffile action=upload

Hello,
I am creating an e-mail application which allows user to attach upto 3 files. I have a special button called "PREVIEW" in my program. The funstion of the button is to show the body and the source address of the attachments. If any of the attachments is an image it should open the image and dispaly it as attachment while all other files should show the normal source address. I want to do this by uploading the image/* files to server and bring it back to display them. If there is any other way please suggest me.

When I tried with my idea...my code looks like below

<cfif fileExists("#form.file1#")>
Attachment1:<br>
<input name="file1" type="hidden" value="#form.file1#">
#form.file1#
<cffile action="upload" fileField="form.file1" accept="image/*" nameconflict="makeunique"
destination="C:\CFusionMX\wwwroot\address_book\">
<hr><br><br>
</cfif>
<cfif fileExists("#form.file2#")>
Attachment2:<br>
<input name="file2" type="hidden" value="#form.file2#">
#form.file2#
<cffile action="upload" fileField="form.file2" accept="image/*" nameconflict="makeunique"
destination="C:\CFusionMX\wwwroot\address_book\">
<hr><br><br>
</cfif>
<cfif fileExists("#form.file3#")>
Attachment3:<br>
<input name="file3" type="hidden" value="#form.file3#">
#form.file3#
<cffile action="upload" fileField="form.file3" accept="image/*" nameconflict="makeunique"
destination="C:\CFusionMX\wwwroot\address_book\">
</cfif><br><br>

The process is uploading the files succesfully but when the file is not an image/* it shows as error...How can I determine which is image file and which is not? If I can know that I can use an if condition and stop other files to be uploaded. Also ,can anyone suggest me how to display files which are located on the server at some known address using HTML.

Thanks for your time and consideration.
venkatgill

Reply With Quote
  #2  
Old January 10th, 2005, 08:16 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 25 m 55 sec
Reputation Power: 53
You can use the "accept" attribute of the cffile tag to limit what types of files can be uploaded (based on their file extension). You could also manually inspect the file extensions of your files.

You can get the contents of any directory on the server, images or otherwise, by using cfdirectory.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old January 10th, 2005, 11:44 AM
venkatgill venkatgill is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 9 venkatgill User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I tried to limit the typr of attachement by using

<cffile action="upload" fileField="form.file2" accept="image/*" nameconflict="makeunique" destination="C:\CFusionMX\wwwroot\address_book\">
I want the code to recognize the extension of the file. The user dont know which attachment is image and which is others. So, if any of the attachments is an image it should find it and upload it else it has to disard the upload action.

Thanks for your time.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > problem with cffile action=upload


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT