For this plugin, I'v been able to upload and manage my files perfectly. The problem begins with deleting a file after it's been uploaded and appears in the upload queue.

Originally the index.php file where the uploader is located looks like this:

error_reporting(E_ALL | E_STRICT);
require('UploadHandler.php');

$upload_handler = new UploadHandler();

However, the way I've customized this in order to upload files in a specified directory, the index file now looks like this:

error_reporting(E_ALL | E_STRICT);
require_once('../../plugins/jqupload/server/php/UploadHandler.php');


$job = $_POST['path'];


$customer_path_files =  $_SERVER['DOCUMENT_ROOT']. '/'.$job.'/';
$customer_path_url = '../../'. JOB_FILES_PATH.$job.'/';
    if (!file_exists($customer_path_files)) {

    @mkdir($customer_path_files ,0777,true);


}

$options=array(
'upload_dir' => $customer_path_files,
'upload_url' => $customer_path_url ,
'max_number_of_files' => 10
);

$upload_handler = new UploadHandler($options);

This also works perfectly. The only problem begins when clicking on the delete button that doesn't fire. Any ideas? Do I need to pass another value somewhere?

有帮助吗?

解决方案

What I did to delete the uploaded file is to create a deleteBtn in the done: and add the click function to it and in there just do an ajax call using that file name, I had to also re-create the full file name that get's extra stuff put on it before writing it to disk somewhere, then it will delete it from the specified location from your props file.

Then just deleteBtn.appendTo($('#someOtherDiv')) that shows the uploaded file and then it has the delete button right next to it.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top