im trying to do file extension checking but its not working :(
i have the following in the head
this is the html code
the {} are things inserted via php
i believe it is something to do with the onclick
[HTML] <form name="upload" action="{THIS}" method="post" enctype="multip art/form-data">
<input type="hidden" name="MAX_FILE_ SIZE" value="6510200" >
<input type="hidden" name="op" value="upload" />
<input type="hidden" name="dir" value="{NEXT_DI R}" />
<table border="0" width="100%" cellpadding="1" >
<tr class="task_cel l">
<td width="5%" nowrap="nowrap" ><b>{LOCAL}</b> </td>
<td width="70%"><in put type="file" name="local" size="45" style="width: 90%" onchange="javas cript:filename( );" /></td>
<td valign="bottom" align="right">< input onclick="javasc ript: window.location .href = '{MULTI_UPLOAD} ?dir={NEXT_DIR} ';" type="button" value="{MULTIPL E}" /></td>
</tr>
<tr class="task_cel l">
<td width="5%" nowrap="nowrap" ><b>{UPNAME}</b> </td>
<td width="70%"><in put type="text" name="remote" size="45" style="width: 90%" /></td>
<td align="right" valign="bottom" ><input onclick="javasc ript: return isValid(); return LimitAttach(thi s.form, this.form.local .value);" type="submit" value="{UPLOAD} " /></td>
</tr>
</table>
</form>[/HTML]
if anyone knows whats wrong please help, i will even pay you if you dont need too much as my site cant survive atm without it :)
[HTML]<input onclick="javasc ript: return isValid(); return LimitAttach(thi s.form, this.form.local .value);" type="submit" value="{UPLOAD} " /> [/HTML]
is most likley where im going wrong
i have the following in the head
Code:
<script language="JavaScript"> extArray = new Array(".jpg", ".png", ".bmp"); function LimitAttach(form, file) { allowSubmit = false; if (!file) return; while (file.indexOf("\\") != -1) file = file.slice(file.indexOf("\\") + 1); ext = file.slice(file.indexOf(".")).toLowerCase(); for (var i = 0; i < extArray.length; i++) { if (extArray[i] == ext) { allowSubmit = true; break; } } if (allowSubmit) return true; else alert("Please only upload files that end in types: " + (extArray.join(" ")) + "\nPlease select a new " + "file to upload and submit again."); return false; } // End --> </script>
the {} are things inserted via php
i believe it is something to do with the onclick
[HTML] <form name="upload" action="{THIS}" method="post" enctype="multip art/form-data">
<input type="hidden" name="MAX_FILE_ SIZE" value="6510200" >
<input type="hidden" name="op" value="upload" />
<input type="hidden" name="dir" value="{NEXT_DI R}" />
<table border="0" width="100%" cellpadding="1" >
<tr class="task_cel l">
<td width="5%" nowrap="nowrap" ><b>{LOCAL}</b> </td>
<td width="70%"><in put type="file" name="local" size="45" style="width: 90%" onchange="javas cript:filename( );" /></td>
<td valign="bottom" align="right">< input onclick="javasc ript: window.location .href = '{MULTI_UPLOAD} ?dir={NEXT_DIR} ';" type="button" value="{MULTIPL E}" /></td>
</tr>
<tr class="task_cel l">
<td width="5%" nowrap="nowrap" ><b>{UPNAME}</b> </td>
<td width="70%"><in put type="text" name="remote" size="45" style="width: 90%" /></td>
<td align="right" valign="bottom" ><input onclick="javasc ript: return isValid(); return LimitAttach(thi s.form, this.form.local .value);" type="submit" value="{UPLOAD} " /></td>
</tr>
</table>
</form>[/HTML]
if anyone knows whats wrong please help, i will even pay you if you dont need too much as my site cant survive atm without it :)
[HTML]<input onclick="javasc ript: return isValid(); return LimitAttach(thi s.form, this.form.local .value);" type="submit" value="{UPLOAD} " /> [/HTML]
is most likley where im going wrong
Comment