Link to home
Start Free TrialLog in
Avatar of g118481
g118481

asked on

Validate File Upload?

I wish to validate a file upload.  That is, I want to only accept a file upload from a customer that fits the "file name" convention I have chosen.  I want them not to be able to upload their file, and receive an error message if their file name does not fit the following specs.

1.  file name cannot be more than 18 characters(not including the "." and file extention).
2.  no upper case
3.  no characters other that alfa, numeric, and a max of two underscores.

Here is my "add.cfm" form code.  How would I alter it to accommadate my requirements?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<html>
<head>
<title>DOCUMENT MANAGEMENT TOOL</title>
<STYLE type=text/css>
td.text {COLOR: black; FONT: 10px arial; TEXT-DECORATION: none}
td.titletext {COLOR: black; FONT: 10px arial; font-weight: bold; TEXT-DECORATION: none}
td.pagetitletext {COLOR: white; FONT: 20px arial; TEXT-DECORATION: none}
td.notetext {FONT: 10px arial; TEXT-DECORATION: none}
</STYLE>
</head>

<body bgcolor="steelblue">
<table border="0" width="100%">
   <tr>
   <td align="center" class="pagetitletext" width="100%">M/F Projects A-D - [ADD - FILE]</td>
   </tr>
</table>
<br>
<cfform action="DocumentManagment_action.cfm" method="post" enctype="multipart/form-data">
<input type="hidden" name="datepublished" value="<cfoutput>#DateFormat(Now())#,#TimeFormat(Now())#</cfoutput>">
<table align="center" border="0" width="600" style="border: 2 outset #808080" cellspacing="0" cellpadding="0" bgcolor="#F0F0F0">
   <tr>
     <td align="right" class="titleTEXT" width="140" bgcolor="#ffffcf">DOC TITLE :&nbsp;&nbsp;</td>
     <td width="450"><cfinput required="yes" message="ENTER IN A TITLE FOR THIS DOCUMENT" type="text" name="DOCUMENTNAME" size="65"></td>
   </tr>
<tr>
     <td align="right" class="titleTEXT" width="140" bgcolor="#ffffcf">FILE :&nbsp;&nbsp;</td>
     <td width="450"><INPUT type="file" name="UploadedFile" size=30></td>
   </tr>
<tr>
     <td align="right" class="titleTEXT" width="140" bgcolor="#ffffcf">AUTHOR :&nbsp;&nbsp;</td>
     <td width="450"><cfinput required="yes" message="ENTER IN AN AUTHOR FOR THIS DOCUMENT" type="text" name="AUTHOR" size="65"></td>
   </tr>
</table>
<INPUT type="hidden" name="ServerFile">
<BR>
<table width="500" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="250" align="center"><INPUT type="submit" name="btnaddfile_OK" value="    OK    "></td>
<td width="250" align="center"><INPUT type="submit" name="BACK" value="Cancel"></td>
</tr>
</table>
</cfform>


</body>
</html>
Avatar of Moondancer
Moondancer

I WILL REFUND THIS TO YOU....

g118481---->  These are your open questions here.  Many date back to the year 2000.  Help requested, help given and open today.

https://www.experts-exchange.com/jsp/qShow.jsp?ta=coldfusion&qid=11397018
https://www.experts-exchange.com/jsp/qShow.jsp?ta=winnt&qid=20171262
https://www.experts-exchange.com/jsp/qShow.jsp?ta=mssql&qid=20166677
https://www.experts-exchange.com/jsp/qShow.jsp?ta=mssql&qid=11811578
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20192428
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20006788
https://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=11947538
https://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=11626838
https://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=11373117
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20233826
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20182621
https://www.experts-exchange.com/jsp/qShow.jsp?ta=coldfusion&qid=20268689
https://www.experts-exchange.com/jsp/qShow.jsp?ta=coldfusion&qid=20263774
https://www.experts-exchange.com/jsp/qShow.jsp?ta=coldfusion&qid=20256576
https://www.experts-exchange.com/jsp/qShow.jsp?ta=coldfusion&qid=20187192
https://www.experts-exchange.com/jsp/qShow.jsp?ta=coldfusion&qid=20121821

Your options are:

1.  Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3.  Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4.  Delete the question. Again, you must tell the other participants why you wish to do this.

Please click this Help Desk link for Member Guidelines, Member Agreement and the Question/Answer process:  Click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues.

https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

PLEASE DO NOT AWARD THE POINTS TO ME.  
_________________________________________
------------>  EXPERTS:

Please leave any comments regarding this question here on closing recommendations if this item remains inactive another three days.

Thank you everyone.

Moondancer
Community Support Moderator @ Experts Exchange

P.S.  For year 2000 question, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.

ASKER CERTIFIED SOLUTION
Avatar of Moondancer
Moondancer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial