« Return to Thread: Get File Count? + Extended error message.
Re: Get File Count? + Extended error message.
by Diego A.
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View in Thread
Hi,
At the moment, you could use the STRING property to do this yourself:
* Method 1: Using class property (and MetaData plugin)
class="multi {STRING: {remove:'Remove',selected:'Selected: $file',denied:'You cannot select $ext files!\nYou can only select [WHATEVER YOU WANT TO SAY HERE]'}}"
* Method 2: Programatically (without MetaData plugin)
$(function(){
$('#MyUpload').MultiFile({
STRING: {
remove:'Remove',
selected:'Selected: $file',
denied:'You cannot select $ext files!\nYou can only select [WHATEVER YOU WANT TO SAY HERE]'
}
});
});
But as part of the next version I will make this automatic, based on the accepted extensions...
Thanks for the suggestion!
Diego A.
At the moment, you could use the STRING property to do this yourself:
* Method 1: Using class property (and MetaData plugin)
class="multi {STRING: {remove:'Remove',selected:'Selected: $file',denied:'You cannot select $ext files!\nYou can only select [WHATEVER YOU WANT TO SAY HERE]'}}"
* Method 2: Programatically (without MetaData plugin)
$(function(){
$('#MyUpload').MultiFile({
STRING: {
remove:'Remove',
selected:'Selected: $file',
denied:'You cannot select $ext files!\nYou can only select [WHATEVER YOU WANT TO SAY HERE]'
}
});
});
But as part of the next version I will make this automatic, based on the accepted extensions...
Thanks for the suggestion!
Diego A.
HI Diego,
Thanks. That would be great!
I'm requesting another feature if possible.
If someone is trying to upload a file type that is not accepted, the alert files and says they cannot upload ".jpg" for instance.
It should also tell them what kind of files they are allowed to upload.Diego A. wrote::>> "Is there away to get the actual number of files inputted afterFileAppend and afterFileRemove ?"
Yes, soon. I am going to store the list of selected files in an array, so essentially you'll be able to do this:
$('#myUpload').files.length;
:>> "Also I am using my own validation function, what's the proper way to remove a file if it doesn't pass validation?"
The only 'proper' way of removing a file is to use the "onFileAppend" event and return false.
eg.: $('#FileUpload').MultiFile({ onFileAppend: function(){ return false; } });
the above will reject any file selection...
After a file has been accepted, the only way to remove it is via the 'remove' link created by the plugin, there is no public interface/api for this function. But you've raised a good point and I'll look into creating one...juliandormon wrote:Hi there.
Great plug-in. Thanks!
Is there away to get the actual number of files inputted afterFileAppend and afterFileRemove ?
That would be really useful for managing other scripts that may react based on the number of files being uploaded.
For example, I display a warning if 2 or more files are being uploaded.
Also it would be great if the alert box also told the user what file types they ARE allowed, not just what they are not allowed to upload.
Also I am using my own validation function, what's the proper way to remove a file if it doesn't pass validation?
This is what I have so far:
onFileAppend:function(element,value,master){
checkFileUploadRHM('gallerySettingsForm2', element.id, '', 1)
if (!field.uploadOK){
errStr = errStr + 'File names can contain only letters, numbers, hyphens, underscores and no spaces.\n\n'
alert('File sucks');
}
}
checkFileUploadRHM should return field.uploadOK as true or false.
If false, I want the file to be removed (or not added).
As a side, checkFileUploadRHM returns true or false for my other scripts, but for some reason it is not passing this back as shown above. Can this be done? I'm a bit behind when it comes to this advanced stuff.
Thanks again!
« Return to Thread: Get File Count? + Extended error message.
| Free Forum Powered by Nabble | Forum Help |