deleted uploaded files still uploads

deleted uploaded files still uploads

roi8877roi8877 Posts: 5Questions: 2Answers: 0

Hello,

We have setup dataTables and Editor and appear to be working fine as in populating tables, making edits and uploading files. It has been setup to allow multi-files upload and this is working fine as well.

However, when a file or files are selected to be uploaded, then we click the X button to cancel the file upload, or in other wards, decided we no longer wish to upload the file we just selected, so we click the X, the file is gone from the upload screen, however when clicking the update button, the file/files are still getting upload or recorded into the database.

Would this be a bug or am I missing some configuration?

Part of the editor initialization below:
{
label: "Documentation:",
name: fileField,
type: "uploadMany",
display: function (file_id) {
var file = editor.file('files', file_id);
var fileName = file.fileName.substring(file.fileName.lastIndexOf('\') + 1);
return '<a href="' + file.web_path + '" download="' + fileName + '">' + fileName +'</a>';},

Version of Editor is: 1.9.0

Version of dataTable below:

src="https://cdn.datatables.net/buttons/1.5.6/js/dataTables.buttons.min.js"
src="https://cdn.datatables.net/select/1.3.0/js/dataTables.select.min.js"
src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.colVis.min.js"
src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.html5.min.js"
src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.print.min.js"
src="~/js/libs/dataTables.checkboxes.min.js"
src="~/js/libs/dataTables.editor.min.js"

Thanks

Answers

  • allanallan Posts: 63,213Questions: 1Answers: 10,415 Site admin

    Hi,

    The upload of the file is actually async to the rest of the form. It happens as soon as the file is selected from the browser's file selector window. This is done so the "value" of the upload input is actually just a foreign key reference to the record that contains information about the file.

    What you are ending up with here is what we call an orphaned file and you might want to configure your server-side scripts to handle them (delete them when found for example).

    Regards,
    Allan

  • roi8877roi8877 Posts: 5Questions: 2Answers: 0

    Yes I did notice that it is async and Ok with the orphan file.What I'm referring to is while the main form hasn't been uploaded and we choose to delete the file by clicking the X button next to the file, the file does disappear from the form, indicating that when we push the upload button, the file link won't be written to the database, etc. But in this case, the X just merely remove the link to the file from the screen, but upon clicking update, it is like we never clicked the X to remove the file. The file reference still get's written to to the database.

  • allanallan Posts: 63,213Questions: 1Answers: 10,415 Site admin

    I've just tried to replicate the issue with this example but unfortunately wasn't able to do so. Does it work as expected for you, or does it show the error condition you describe?

    You note that you are using Editor 1.9.0 - it would be worth updating to 1.9.4 which is the current release.

    Allan

  • roi8877roi8877 Posts: 5Questions: 2Answers: 0

    We managed to upgrade it to the latest version and the issue still persist. Since the example you gave is working fine, we would then have to be think that the issue lies on our implementation.

    Might you have any other test we could do to figure this all out?

  • allanallan Posts: 63,213Questions: 1Answers: 10,415 Site admin

    I would have thought that this was entirely a client-side issue, so if it works on our site, I'd have expected it to work elsewhere. Obviously not the case though! Are you able to give me a link to the page showing the issue?

    Allan

This discussion has been closed.