srs81 / CakePHP-AjaxMultiUpload

CakePHP 2 plugin to allow for easy multi-file upload with AJAX
Other
65 stars 33 forks source link

File parameter missing #11

Open jasonchua89 opened 12 years ago

jasonchua89 commented 12 years ago

Hi there,

Thanks for this awesome plugin. However, I am having an issue with deleting some files. When I upload any file, it uploads properly but when deleting some files, it gives me "file parameter missing" but for other files, they delete fine. Not sure what the problem is. Eg. I uploaded two .png files that are of different file names, one of them deleted fine, the other raises the "file parameter missing" error.

Hope you can help me with this.

Thanks!

srs81 commented 12 years ago

Hmmm, strange, I haven't seen this before. Do you notice anything specific about the files that can't be deleted? Spaces, special characters, etc? Anything odd about them? If you could send me a sample list of file names and which ones don't work, I can look into it and probably find out what happened.

jasonchua89 commented 12 years ago

I didnt notice anything specific about the files that can't be deleted. Not sure why they're behaving this way. Below is a sample list of the files that can and cannot be deleted.

Successful Delete: 3-Claytoncolour.pdf Database New.jpg timetable.pdf unit plan.pdf

Unsuccessful Delete: 3333-cl-bbis-2011.doc Issues List Description.doc Timetable Y3S1.jpg Y3S1 Exam Timetable.jpg jquery-ui-1.8.20.custom.zip qmanual.pdf Course Outline.jpg grid_timetable.xls Results.xlsx

jasonchua89 commented 12 years ago

Hi,

Have you had the chance of finding out what's causing the error? I still cant find what's wrong with it.

Cheers.

andranos commented 12 years ago

Yes, i got the same issue. It's only happening for the first file that i uploaded. The second and the rest of them are just fine

jasonchua89 commented 12 years ago

It's happening for random files for me. Be it second, third or fourth file uploaded.

andranos commented 12 years ago

I'm not sure if it's related or not, my view.ctp and edit.ctp are inside the plug in folder as i'm using this plugin for another plugin. Because i tried this on my local machine where the view and edit files are located in the default folder (app/view/.../view.ctp) and it all works just fine... And yeah, it's happening for random files as well for me

andranos commented 12 years ago

Anyone find anything about this problem?

jasonchua89 commented 12 years ago

Still not working for me. Not sure what else I can do. Sorry. =( I hope the author replies soon with a solution....

srs81 commented 12 years ago

Can you guys do me a favor. In this file /View/Helper/UploadHelper.php, replace lines 34-35 with this one line:

$str .= "<a href='$delUrl'>Delete $baseEncFile</a> ";

And let me know whether the baseEncFile is empty for any of the files that have a problem? It looks like its not base64 encoding properly.

jasonchua89 commented 12 years ago

Sorry. Could you be more specific as to which lines I have to replace?

lines 34-35 for me is: if ($edit) { $baseEncFile = base64_encode ($file);

andranos commented 12 years ago

It shows something like this Delete RDpcV2Vic2l0ZXNcaWVccHJvamVjdDA4XHBlbm55aGVhbHRoLXYyXGFwcFx3ZWJyb290XFxmaW so i'm guessing this means baseEncFile is not empty

srs81 commented 12 years ago

Hmmm, I think I know what is going on. Do you mind sharing the directory path that your files are on? That might have something to do with this. The root file directory might be too long, but I would like to confirm.

srs81 commented 12 years ago

In the very first line of this plugin file: Controller/UploadsController.php, can you change is_null() to one of these two:

  1. (!isset($file))
  2. if ($file === null)

and see if that fixes the issue?

andranos commented 12 years ago

Yeah i think it's too long as well. This is the link ie.infotech.monash.edu.au/project08/pennyhealth-v2. Unfortunately, already tried those 2 codes but didn't fix the problem

andranos commented 12 years ago

Well, it's getting worse, now i can't delete any file i uploaded lol. Hmm i don't know if this got something to do with it. Everytime i tried to upload a file, the "Failed" message keep appearing even though it's successful

jasonchua89 commented 12 years ago

Hi srs81, I tried changing is_null to those two codes too. Still not working as well.

andranos commented 12 years ago

Jason , did you get the failed message as well when you uploaded a file? I got that for every files i uploaded

jasonchua89 commented 12 years ago

Hmmm. No. It works fine for me. There's no failed message.