Jump to content

Drag 'n drop uploading generates duplicate files


apeisa
 Share

Recommended Posts

I recently updated to latest PW and it seems to have introduced one bug: when drag 'n dropping files it doubles the file and starts immediately two upload bars. I tried to figure out which is causing this behavior, but couldn't figure out.

  • Like 1
Link to comment
Share on other sites

Strange. I have double checked that this isn't browser cache issue or something like that. I have multiple sites having this issue currently (I have /wire/ as symlink, I test with few sites and if all runs correctly I update all our sites). Also tested with multiple browsers and users.

I will test this more later on. There is nothing too special running on those sites. For some reason js file posts two times when files are dropped.

Or have there been index.php update required or something like that?

Link to comment
Share on other sites

I was able to reproduce this, and did some tests.

The duplication happened on the same page, but only for the "images" field that came on the original install... didn't happen for a image field that i created later.

I created two more fields, one cloned from the original "images" and a new one with the default settings.

Then, I created a new template, and populated it with all the four fields -- the two from the first test, and the newly created ones.

On a new page with this template, the duplication happened on both, the "images" field and its clone (!), and not on the other two.

Also, it only happened to files bigger than approximately 17KB.

edit: tested with jpg, png and gif. they all behaved the same way

  • Like 1
Link to comment
Share on other sites

The problem is on the "Display thumbnails in page editor" option.

I looked for what was different in the original "images" field, and the ones that I just created, and this was one of those things. I tested all of them with and without the option checked, and it does make the difference.

Link to comment
Share on other sites

I was able to duplicate this. The problem was the recently introduced version numbers that are appended to $config->scripts (and $config->styles). InputfieldImage manually adds InputfieldFile.js to $config->scripts, as it always has. But it knows nothing about version numbers. The result was that if you had both a file and an image field on the same template, the same InputfieldFile.js would get included twice (one with version number, one without). All that JS in InputfiledFile.js would also execute twice when you dragged in a file. Thanks for finding this bug--I just committed a fix for this. I don't want to have to append version numbers ever time I manually add a script/style from a module, so I setup PW to ensure uniqueness of these at the time they are added (regardless of version number). I'm not yet sure why the display thumbnails option would make a difference here, but will experiment more. Please let me know if you find any issues remain.

Thanks,

Ryan

  • Like 2
Link to comment
Share on other sites

Ryan, forget the thumbnails thing... my testings where based on a very silly mistake.

I assumed the 0x100 created for the thumbnail were the duplicated file that was appearing to Antti. Next time I will also check the names of the files, instead of just glancing at the thumbnails of the file manager :S

I realized this right after I left for lunch, and was going to post as soon as I would come back to the computer. Glad you found out the problem before...

Link to comment
Share on other sites

  • 2 years later...

ryan, i still run into this issue. 

the InputfiledFile.js gets included twice. once as normal file without versionnumber and once as minified file with versionnumber ( see attached screenshot ).

after i took the minified version out, everthing works as it should ( means there are no longer dublicates during the fileupload ).

my pw version is the 2.5.26.

Thanks!!

post-2037-0-93281200-1429158082_thumb.pn

Link to comment
Share on other sites

  • 2 weeks later...

I also run into the same problem, like isberni i use 2.5.26.

@isberni: how did you took the minified version of InputfiledFile.js out?

(After testing some more: on some pages this effect happens, on some not, though its the same template...)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...