Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
PHP File Uploader
»
Re: Setting max files
Setting max files
Last post 01-13-2012, 2:29 PM by
Kenneth
. 1 replies.
Sort Posts:
Oldest to newest
Newest to oldest
Previous
Next
01-13-2012, 12:21 PM
72688
fchristensen
Joined on 01-13-2012
Posts 3
Setting max files
Reply
Quote
Hi
Sorry if this has been covered before but how do you set a max file validation? To clarify: We only wish for the user to be able to select and upload 5 files. Is this at all possible?
Kind regards,
Fred
01-13-2012, 2:29 PM
72692
in reply to
72688
Kenneth
Joined on 02-13-2008
Posts 3,886
Re: Setting max files
Reply
Quote
Hi
fchristensen,
Please try the example below, it shows you how to limit the upload files to 5.
<?php require_once "phpuploader/include_phpuploader.php" ?>
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>example</title>
</head>
<body>
<div>
<?php
$uploader=new PhpUploader();
$uploader->Name="myuploader";
$uploader->MultipleFilesUpload=true;
$uploader->InsertText="Upload File (Max 10M)";
$uploader->MaxSizeKB=1024000;
$uploader->AllowedFileExtensions="jpeg,jpg,gif,png,zip";
$uploader->MaxFilesLimit=5;
$uploader->Render();
?>
</div>
<script>
var count = 0;
function CuteWebUI_AjaxUploader_OnQueueUI(list) {
count = list.length;
}
function CuteWebUI_AjaxUploader_OnSelect(files)
{
var temp;
temp = count;
count = count + files.length;
if (count > 5) {
alert("only allow to upload 5 files!");
count = temp;
return false;
}
}
</script>
</body>
</html>
Regards,
Ken