jQuery: The Write Less, Do More JavaScript Library

Get File Count? + Extended error message.

by juliandormon :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View in Thread

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.

LightInTheBox - Buy quality products at wholesale price!