Following the transition from a Windows environment to Linux and modernise a code. I meet a new problem. I send a csv file. But when i click on the button in order to handle it, nothing happens
<?php
echo "<form enctype=\"multipart/form-data\" id=\"form_impmat\"
name=\"form_impmat\" action=\"\" method=\"post\">\n";
....
echo "<p><input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"1000000\"
/>\n
Fichier au format CSV : <input name=\"userfile\" type=\"file\"
style=\"border:1px solid #CCCCCC;\" />\n
<a href=\"javascript:valid_form();\" title=\"Envoyer le
fichier\" class=\"submit\">Envoyer le fichier</a></p>\n</form>";
?>
I think that the problem is in the javascript :
<script type="text/javascript">
function valid_form() {
if(document.layers) {
form = document.layers('form_impmat');
}
//IE6
if(document.all) {
form = document.all('form_impmat') ;
}
//Netscape 6
if(!document.all && document.getElementById) {
form = document.getElementById('form_impmat') ;
}
var valid = false;
if (form.ORDER_DETAILS_ID.length != null) {
for (var i=0 ; i < form.ORDER_DETAILS_ID.length ; i++) {
if (form.ORDER_DETAILS_ID[i].checked) {
valid = true;
}
}
} else {
if(form.ORDER_DETAILS_ID.checked)
valid = true;
}
var message = "";
if (form.userfile.value == "") message += "Vous n'avez spécifié aucun
fichier !\n";
if(!valid) message += "Vous n\'avez pas choisi de commande !\n";
if (message != "") alert('Opération annulée!\n\n'+message);
else form.submit();
}
</script>
Nothing happens but in the old version, the csv file is handled