Help with Upload script = "Must agree to terms first

The script I’ve installed (successfully) allows the user to drag/drop, or choose a file, to upload.
Can you provide some guidance, maybe an example, of how I can add a feature where the user must agree to the Terms before the dragged/dropped/chosen file can be uploaded? Here’s my current code:

<html>
<head>
<script src="../js/dropzone.min.js"></script>
<script src="../js/dropzone.js"></script>
<link href="../css/dropzone.css" type="text/css" rel="stylesheet" />
</head>

<body>
<div id="dropzone">
<form action="../uploadTest.php" class="dropzone"></form>
</div>
</body>
</html>
<?php
$ds          = DIRECTORY_SEPARATOR;
$storeFolder = 'uploads';
if (!empty($_FILES)) {
    $tempFile = $_FILES['file']['tmp_name'];
    $targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds;
    $targetFile =  $targetPath. $_FILES['file']['name'];
    move_uploaded_file($tempFile,$targetFile);
}
?>

Any help is appreciated…

Is this uploading the file as soon as it is drag/dropped? We will need to see dropzone.js and dropzone.min.js

Your uploading system is very prone to exploits. Allowing the user to choose what they can name the file is very dangerous and should be avoided at all times.

Thanks for the replies. “Is this uploading the file as soon as it is drag/dropped?” Yes.
I’ve attached the files you requested dropzone.js and dropzone.min.js. They had too many characters for pasting the code to this thread, apparently.

Also, any help with what I could do to avoid allowing the user to “choose what they can name the file”, will be appreciated.

dropzone.js (117.8 KB)

dropzone.min.js (41.8 KB)

You might want to start with sending an email to the guy that wrote it and ask him.

Matias Meno m@tias.me

store seperate path and name in a database and use the name to display the filename on a webpage and set the appropriate header for downloads. use an ID anywhere else.

As for the question, I’d probably have a tick-box on the screen that they must tick to indicate acceptance, and only make the upload script active once it’s ticked.

I’m not big on JavaScript, but I’m sure there’s a way for the upload code to check whether or not a tick-box is checked before continuing with the upload.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.