Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automatic file naming
#3
(06-16-2011, 01:22 PM)netco Wrote: Hello,

is there anyway, that an uploaded document gets its filename automaticly when entering no specific name for it (and not uploading multiple files)?

Best regards,
netCo

I decide to do this feature by my own because it is much convenient )
You can simple use linked out.AddDocument.php from attachment.
The changes are:
Quote:<td><?php printMLText("name");?>:</td>
<td><input name="name" size="60">
<input type="checkbox" id="nameused" name="nameused" disabled="disabled" checked="checked" value="1">
<a href="javascript:disableName()"><?php printMLtext("selection") ?></a>
</td>
and
Quote:function disableName()
{
if(document.getElementsByName("userfile[]").length==1){
if(document.form1.nameused.checked==true){
document.form1.nameused.checked=true;
document.form1.name.disabled=true;
}else{
document.form1.nameused.checked=false;
document.form1.name.disabled=false;
}
}
}
Add one line in addFiles function
Quote:function addFiles()
{
document.getElementById("files").innerHTML += '<br><input type="File" name="userfile[]" size="60">';
document.form1.name.disabled=true;
document.form1.nameused.checked=false;
}
And change one line in the function checkform
Quote://if (document.form1.userfile[].value == "") msg += "<?php printMLText("js_no_file");?>\n";
if(!document.form1.name.disabled){
if (document.form1.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";
}
The main concepts are
1) to add checkbox to see if name field is used or not, default checkbox value checked,
2) to add link that will disable use of name field.
It is better to use new text varaible for link but it will need to make changes in all language files.
"Whatever you do, work at it with all your heart, as working for the Lord, not for human masters". Kol.3:23
Reply


Messages In This Thread
Automatic file naming - by netco - 06-16-2011, 01:22 PM

Forum Jump:


Users browsing this thread: