-
Notifications
You must be signed in to change notification settings - Fork 0
/
sendto.php
56 lines (53 loc) · 1.93 KB
/
sendto.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
if (session_id())
session_start();
include_once("header.php");
include_once("User.php");
$user = new User($username);
$fullname = $user->get_fullname();
$depart = $user->get_department();
?>
<div class="container">
<div class="dropzone" id="shareTo"></div>
<input id='omgUser' type='hidden'>
</div>
</div>
<script>
Dropzone.options.shareTo = {
url: 'upload.php',
paramName: "shareFile",
acceptedFiles: ".png,.jpg,.pdf, .doc, .docx, .odg, .ods, .xlsx,.xls,.ppt, .pptx",
autoProcessQueue: false,
maxFiles: 1,
maxFilesize: 150,
addRemoveLinks: true,
init: function() {
dzClosure = this;
this.on("sending", function(data, xhr, formData){
if($("#public").is("input:checked")){
shareWith = "Public";
}else if($("#user").is("input:checked")){
user = $("#omgUser").val();
if(user == "" || user == undefined){
shareWith = "Public";//Fallback to Public if user not available
}else{
shareWith = user;
}
}else{
shareWith = $("#department").val();
}
formData.append("sharewith", shareWith);
})
.on("success", function(file, res) {
if(res == "File has been shared with " + shareWith){
$(".alert").removeClass("hide").addClass("alert-success").html(res.toUpperCase());
}else{
$(".alert").removeClass("hide").addClass("alert-info").html(res.toCase());
}
})
.on("maxfilesexceeded", function(file) { this.removeFile(file); })
.on("fail",function(error){
$(".alert").removeClass("hide").addClass("alert-danger").html(error)
})
}
}