|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Uploading non existing file check?
Greets,
I'm looking for a way to check if a user is trying to upload a non existing file in a form. (IE: if the user types in the path misstakenly instead of using the browse button.) I've tried the following unsuccessfully: Code:
... <cfif CFFILE.fileSize lt 1> //DISPLAY ERROR MESSAGE HERE </cfif> ... I need of course to be able to differentiate if the user left the field alone, or if he typed in something... Cheers.
__________________
Saintaw pending. |
|
#2
|
||||
|
||||
|
CFFILE.FileSize will work on the server side for verifying if the file exists or not.
Quote:
Use JavaScript. |
|
#3
|
|||
|
|||
|
And due to security issues I'm pretty sure that you can't look into the file system from Javascript. In other words, I am not sure that you can do this unless you go to a Java applet or ActiveX control.
__________________
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 |
|
#4
|
||||
|
||||
|
Ew.. thanks lads
![]() |
|
#5
|
|||
|
|||
|
how about this
<input type="text" name="filename" readonly> I think it's read only .. this will force them to use the browse button.. so you can guarantee the file did exist. disabled might work if readonly is the wrong argument. |
|
#6
|
|||
|
|||
|
Readonly is not universally supported by all browser though. This might work in most cases, but it wouldn't be 100%.
|
|
#7
|
||||
|
||||
|
Very cool, My users are forced to use IE (company policy).
Thanks again! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Uploading non existing file check? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|