i have the following in the head
Expand|Select|Wrap|Line Numbers
- <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="multipart/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_DIR}" />
<table border="0" width="100%" cellpadding="1">
<tr class="task_cell">
<td width="5%" nowrap="nowrap"><b>{LOCAL}</b> </td>
<td width="70%"><input type="file" name="local" size="45" style="width: 90%" onchange="javascript:filename();" /></td>
<td valign="bottom" align="right"><input onclick="javascript: window.location.href = '{MULTI_UPLOAD}?dir={NEXT_DIR}';" type="button" value="{MULTIPLE}" /></td>
</tr>
<tr class="task_cell">
<td width="5%" nowrap="nowrap"><b>{UPNAME}</b> </td>
<td width="70%"><input type="text" name="remote" size="45" style="width: 90%" /></td>
<td align="right" valign="bottom"><input onclick="javascript: return isValid(); return LimitAttach(this.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="javascript: return isValid(); return LimitAttach(this.form, this.form.local.value);" type="submit" value="{UPLOAD}" /> [/HTML]
is most likley where im going wrong