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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with <input type="file" name="file"> & isd 2

Status
Not open for further replies.

josel

Programmer
Oct 16, 2001
716
US
Howdy y'all!

I am having a problem, a minor one for most of you I am sure.

I have two forms. *form1* has a form with action set to *form2* (form names not actual names). Within *form1*, I have one <input type=&quot;file&quot; name=&quot;file&quot;>.

Within *form2*, I am trying to make sure a file has been chosen to upload. When using <cfif isdefined(&quot;form.file&quot;)> or <cfif isdefined(&quot;#form.file#&quot;)>, I get errors as though the form variable is not passed alone with other variables from *form1*.

I removed the <cfif ...> alltogether and <cffile ...> then gives me an error saying that *file* does ot contain a file name to upload.

All fields are filled in, and the target and source directories have proper permissions. I noticed that on process report, all variables from *form1* are listed with their respective values, except, *file*.

How do I get around this?

Thank you all in advance!

Regards;


Jose Lerebours

KNOWLEDGE: Something you can give away enlessly and gain more of it in the process! - Jose Lerebours
 
did you include the FORM attribute &quot;ENCTYPE&quot;?

<form action=&quot;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;></form> ....:::::.... xxLargeWASP ....:::::....
 
xxlargewasp,

Thank you for such prompt response. No, I did not!

Is this the reason?

Regards;


Jose Lerebours KNOWLEDGE: Something you can give away enlessly and gain more of it in the process! - Jose Lerebours
 
i guess that's the reason :)
good luck dude ....:::::.... xxLargeWASP ....:::::....
 
Hey xxlargewasp,

Thank God I went to sleep early this morning :cool:

I would have never gone back to the <form ...> command to solve this one!

I have no access to my code right now, but will try this as soon as I can. Thanks very much for your help!

Regards;


Jose Lerebours
KNOWLEDGE: Something you can give away enlessly and gain more of it in the process! - Jose Lerebours
 
Maybe the name=&quot;file&quot; should be something other than a keyword used by CF, use Filename, FileNM, UpFile, or something else.....
 
Hello!

I am making progress but I am not over the hurtle. I am now getting this message:

Error processing CFFILE

The directory specified in the DESTINATION attribute of the CFFILE tag (c:\tmp\IFMS-HelpDesk\) is not valid. The directory either does not exist or is not accessible by the ColdFusion service.


Which I can't understand as I have set pull permission on both \temp and \temp\IFMS-HelpDesk. My C: is not shared however!

What do I need to do to get this one solved?

Thanks;

Jose Lerebours KNOWLEDGE: Something you can give away enlessly and gain more of it in the process! - Jose Lerebours
 
Remember that the destination directory (c:\tmp\IFMS-HelpDesk\) is on the server, not your machine - unless of course you're running the ColdFusion server off your machine.
 
I would recommend that instead of hard coding the directory such as (c:\tmp\IFMS-HelpDesk\) that you use ../ convention for the directory with expandpath.

so if your upload template was in a directory called uploads off the main root and the directory that you wanted to upload to was called images off the main root you would use ../images

so your code would look like

<CFSET fPath = ExpandPath(&quot;../images&quot;)>

<cffile ACTION=&quot;UPLOAD&quot; DESTINATION=&quot;#fPath#&quot; FILEFIELD=&quot;yourformfield&quot;>

this way if you are working off your local machine and you move the ode to your server you don't have to change any of the drive references as expandpath will produce the c:\ etc etc.

hope this helps !
 
arperry,

An excellent suggestion. Makes sence, this practice should standarize my code.

Thank you very much!!!

Regards;


Jose Lerebours
KNOWLEDGE: Something you can give away enlessly and gain more of it in the process! - Jose Lerebours
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top