File upload problem

Discuss MySQL Ajax Table Editor Pro Version

File upload problem

Postby Volle » Mon Mar 23, 2015 10:16 am

Hey,

i'm trying to upload a file like to my server (to a directory on the webserver).
I tried to play around with the UploadToDir.php example but i can't get it to work.

When i try to upload a test .txt file i get the following php error:

Code: Select all
[23-Mar-2015 11:11:35 Europe/Belgrade] PHP Notice:  Undefined variable: valErrors in \php\AjaxTableEditor.php on line 3895
[23-Mar-2015 11:11:35 Europe/Belgrade] PHP Warning:  unlink(uploads/first line
second line): Invalid argument in \UploadToDir.php on line 122


When i try to upload a .jpeg image i get the following error:
Code: Select all
[23-Mar-2015 10:34:15 Europe/Belgrade] PHP Fatal error:  Uncaught exception 'Exception' with message 'An error occurred in script \php\AjaxTableEditor.php on line 1530: <br /><br  />There was an error executing the following query: <br />insert into emp_upload_dir set `first_name` = :first_name, `last_name` = :last_name, `email` = :email, `department` = :department, `file_name` = :file_name, `hire_date` = :hire_date<br /><br />PDO query params: first_name => 'asd', last_name => 'asdasd', email => 'asdasd', department => 'Accounting', file_name => 'ÿØÿà\0JFIF\0\0`\0`\0\0ÿá\0ZExif\0\0MM\0*\0\0\0\0\0\0\0\0\0\0\0J\0\0\0\0\0\0\0\0Q\0\0\0\0\0\0\0Q\0\0\0\0\0\0tQ\0\0\0\0\0\0t\0\0\0\0\0† \0\0±ÿÛ\0C\0       \n\n\r\n\n    \r  ÿÛ\0C  ÿÀ\0\0\0\"\0ÿÄ\0\0\0\0\0\0\0\0\0\0\0   \n ÿÄ\0µ\0\0\0}\0!1AQa\"q2‘¡#B±ÁRÑð$3br‚   \n\Z%&\'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ in \Common.php on line 26


For me it looks like the the file name isn't the file's name but its content, which obviously fails.
Does anyone know how to fix this?

Greetings
Chris
Volle
 
Posts: 2
Joined: Mon Mar 23, 2015 10:07 am

Re: File upload problem

Postby skg » Mon May 09, 2016 7:46 pm

I have a similar problem.
Has anyone found an answer?
Thanks
George
skg
 
Posts: 2
Joined: Sat Apr 09, 2016 6:23 pm

Re: File upload problem

Postby Volle » Mon May 09, 2016 8:04 pm

I haven't found a fix yet but i didn't need this feature yet.
This doesn't look like a high priority bug since there was no reply in a year :-)
Volle
 
Posts: 2
Joined: Mon Mar 23, 2015 10:07 am

Re: File upload problem

Postby skg » Tue May 10, 2016 3:01 pm

Thanks to you for taking the trouble to reply.
I'll see if the admin can find a solution. :?:
skg
 
Posts: 2
Joined: Sat Apr 09, 2016 6:23 pm

Re: File upload problem

Postby Atara » Wed Feb 07, 2018 8:44 am

I also have similar problem. when inline-adding a new row, that one of its fields is filename, it tries to insert the file content and fails:

Code: Select all
PHP Fatal error:  Uncaught exception 'Exception' with message
'An error occurred in script /xxx/my_mate/php/AjaxTableEditor.php on line 1555:
<br /><br  />
There was an error executing the following query:
<br />
insert into myTable set
`field1` = :field1,
`field2` = :field2,
`field_img` = :field_img,
`field4` = :field4,
`field5` = :field5

<br /><br />

PDO query params:
field1 => '101',
field2 => '1',
field_img => '‰PNG\r\n\Z\n\0\0\0\rIHDR\0\0\0\0\0€\0\0\0€א›^\0\0\0sRGB\0...ytְ?
in /xxx/my_mate/Common.php on line 35


[field4, field5 do not get params value...]
Atara
 
Posts: 12
Joined: Wed Jul 26, 2017 9:01 am

Re: File upload problem

Postby Atara » Wed Feb 07, 2018 9:46 am

temporary solution:
do not allow "[A]dd" permission to the fileName field.
when adding a new row, first add all other fields. and only after saving the row, one can update the fileName field.
Atara
 
Posts: 12
Joined: Wed Jul 26, 2017 9:01 am

Re: File upload problem

Postby thehrushi » Wed Jun 13, 2018 3:34 pm

I have this exact same issue. The [A]dd permissions solution is not a fix, just a workaround. Anyone found a real solution yet?
thehrushi
 
Posts: 7
Joined: Fri May 04, 2018 10:06 pm

Re: File upload problem

Postby spallared » Sat Oct 27, 2018 6:59 pm

Hello, it's a long time but maybe can be still usefull: to fix in the file php/AjaxTableEditor.php substitute the line:

$queryParams[$col] = file_get_contents($_FILES[$col]['tmp_name']);

with the following line:

$queryParams[$col] = $_FILES[$col]['name'];

Regards
Luca
spallared
 
Posts: 1
Joined: Sat Oct 27, 2018 5:44 pm


Return to Pro Version

Who is online

Users browsing this forum: No registered users and 3 guests

cron