Thank stuart.
After a few more painful hours of tinkering, i decided to write the upload/download pages in php.
Works great now. All the escape context is built right in.
Not my favorite option, but why reinvent the wheel.
Brian Boegershausen
From: Stuart Tremain
Sent: Monday, March 20, 10:58 PM
Subject: Re: [WebDNA] Upload file to mysql
To: WebDNA Talk List
http://php.net/manual/en/mysqli.real-escape-string.php
Characters encoded are NUL (ASCII 0), \n, \r, \, ', ", and Control-Z.
Kind regards
Stuart Tremain
Pharoah Lane Software
AUSTRALIA
On 21 Mar 2017, at 13:51, Brian Boegershausen <brian@endeavotech.com> wrote:
You think i should [url]ize the string?
Then i can look for %0A and things like that.Brian Boegershausen
On Mon, Mar 20, 2017 at 10:49 PM -0400, "Stuart Tremain" <webdna@idfk.com.au> wrote:
I think that is where your problem lies.
https://dev.mysql.com/doc/refman/5.7/en/string-literals.html
The MySQL manual page for strings says:
\0 An ASCII NUL (0x00) character.
\' A single quote (“'”) character.
\" A double quote (“"”) character.
\b A backspace character.
\n A newline (linefeed) character.
\r A carriage return character.
\t A tab character.
\Z ASCII 26 (Control-Z).
\\ A backslash (“\”) character.
\% A “%” character.
\_ A “_” character.
Kind regards
Stuart Tremain
Pharoah Lane Software
AUSTRALIA
On 21 Mar 2017, at 13:42, <brian@endeavotech.com> <brian@endeavotech.com> wrote:
I added the ; into my convertchars database. Flushed… still having an issue.
I think I need a bigger list of escape characters L
From: Stuart Tremain [mailto:webdna@idfk.com.au]
Sent: Monday, March 20, 2017 9:45 PM
To: WebDNA Talk List <talk@webdna.us>
Subject: Re: [WebDNA] Upload file to mysql
That is a problem with a character causing MySQL to fail.
Looking at your conversion db it looks like you have covered everything except for ; (semicolon)
There may be something else as well.
Kind regards
Stuart Tremain
Pharoah Lane Software
AUSTRALIA
On 21 Mar 2017, at 12:16, <brian@endeavotech.com> <brian@endeavotech.com> wrote:
ERROR TEXT: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''\%PDF-1.5 \%���� 1 0 obj <
When I look in the errorlog.txt file, the � characters are the following symbols.
âãÏÓ
From: Stuart Tremain [mailto:webdna@idfk.com.au]
Sent: Monday, March 20, 2017 9:03 PM
To: WebDNA Talk List <talk@webdna.us>
Subject: Re: [WebDNA] Upload file to mysql
What is the error ?
Kind regards
Stuart Tremain
Pharoah Lane Software
AUSTRALIA
On 21 Mar 2017, at 12:00, Brian Boegershausen <brian@endeavotech.com> wrote:
Mysql error.
Brian Boegershausen
On Mon, Mar 20, 2017 at 8:59 PM -0400, "Stuart Tremain" <webdna@idfk.com.au> wrote:
Brian, when you say it chokes, do you mean that WebDNA stalls or do you get a MySQL error message ?
Kind regards
Stuart Tremain
Pharoah Lane Software
AUSTRALIA
On 21 Mar 2017, at 11:15, <brian@endeavotech.com> <brian@endeavotech.com> wrote:
Hi Stewart,
I have my content field set to MEDIUMBLOB which allows for 16mb max files.
So far, I am using files around 100kb, so I am not reaching the max yet.
My query writes all the data fields and uploads .txt files, but once I change to a file like a PDF, it chokes.
[showif [referer]^file_manager.dna]
[FormVariables]
[showif [name]^filename]
[text show=F]TheFileNM=[Middle StartAfter=filename="&EndBefore="][name][/middle][/text]
[/showif]
[showif [name]^CPK]
[text show=F]CPK=[value][/text]
[/showif]
[showif [name]^JPK]
[text show=F]JPK=[value][/text]
[/showif]
[/FormVariables]
[hideif [TheFileNM]=]
[hideif [CPK]=]
[hideif [JPK]=]
[FormVariables]
[showif [name]^"thefile"]
[SQLExecute conn_ref=TheBlueBiller&result_var=UPLOAD_INS]
INSERT INTO UPLOAD
(FILE_ID, COMPANY_ID, CLIENT_ID, JOB_ID, NAME, CONTENT, ROW_ADDED_DTTM)
VALUES ('', '[LOGIN_COMPANY_ID]', '[CPK]', '[JPK]', '[TheFileNM]', '[convertchars db=databases/upload.db][value][/convertchars]', '[date %Y-%m-%d %H:%M:%S]')
[/SQLExecute]
[/showif]
[/FormVariables]
[/hideif]
[/hideif]
[/hideif]
[!]========UPLOAD.DB FILE------------[/!]
FROM TO
' \'
" \"
\ \\
% \%
From: Stuart Tremain [mailto:webdna@idfk.com.au]
Sent: Monday, March 20, 2017 6:43 PM
To: WebDNA Talk List <talk@webdna.us>
Subject: Re: [WebDNA] Upload file to mysql
Hi Brian
I have not done that, but providing your MySQL field is LONGBLOB all should work.
Also to be able to insert images that are bigger than 1MB you have to increase the max_allowed_packed option in the server configuration file.
I use Navicat to write all my queries and then copy & paset the query into my WebDNA doc. Navicat makes writing & debugging fast.
Kind regards
Stuart Tremain
Pharoah Lane Software
AUSTRALIA
On 21 Mar 2017, at 07:55, Brian Boegershausen <brian@endeavotech.com> wrote:
Anyone successfully upload a file to a mysql db?
I can upload a text file but that is it.
Jpg and gif fail.Unbuntu 14
Webdna 8.2
Mysql 5.5
Brian Boegershausen
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
Virus-free.
www.avg.com --------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
Virus-free.
www.avg.com --------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
Virus-free.
www.avg.com --------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us --------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
|
Thank stuart.
After a few more painful hours of tinkering, i decided to write the upload/download pages in php.
Works great now. All the escape context is built right in.
Not my favorite option, but why reinvent the wheel.
Brian Boegershausen
From: Stuart Tremain
Sent: Monday, March 20, 10:58 PM
Subject: Re: [WebDNA] Upload file to mysql
To: WebDNA Talk List
http://php.net/manual/en/mysqli.real-escape-string.php
Characters encoded are NUL (ASCII 0), \n, \r, \, ', ", and Control-Z.
Kind regards
Stuart Tremain
Pharoah Lane Software
AUSTRALIA
On 21 Mar 2017, at 13:51, Brian Boegershausen <brian@endeavotech.com> wrote:
You think i should [url]ize the string?
Then i can look for %0A and things like that.Brian Boegershausen
On Mon, Mar 20, 2017 at 10:49 PM -0400, "Stuart Tremain" <webdna@idfk.com.au> wrote:
I think that is where your problem lies.
https://dev.mysql.com/doc/refman/5.7/en/string-literals.html
The MySQL manual page for strings says:
\0 An ASCII NUL (0x00) character.
\' A single quote (“'”) character.
\" A double quote (“"”) character.
\b A backspace character.
\n A newline (linefeed) character.
\r A carriage return character.
\t A tab character.
\Z ASCII 26 (Control-Z).
\\ A backslash (“\”) character.
\% A “%” character.
\_ A “_” character.
Kind regards
Stuart Tremain
Pharoah Lane Software
AUSTRALIA
On 21 Mar 2017, at 13:42, <brian@endeavotech.com> <brian@endeavotech.com> wrote:
I added the ; into my convertchars database. Flushed… still having an issue.
I think I need a bigger list of escape characters L
From: Stuart Tremain [mailto:webdna@idfk.com.au]
Sent: Monday, March 20, 2017 9:45 PM
To: WebDNA Talk List <talk@webdna.us>
Subject: Re: [WebDNA] Upload file to mysql
That is a problem with a character causing MySQL to fail.
Looking at your conversion db it looks like you have covered everything except for ; (semicolon)
There may be something else as well.
Kind regards
Stuart Tremain
Pharoah Lane Software
AUSTRALIA
On 21 Mar 2017, at 12:16, <brian@endeavotech.com> <brian@endeavotech.com> wrote:
ERROR TEXT: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''\%PDF-1.5 \%���� 1 0 obj <
When I look in the errorlog.txt file, the � characters are the following symbols.
âãÏÓ
From: Stuart Tremain [mailto:webdna@idfk.com.au]
Sent: Monday, March 20, 2017 9:03 PM
To: WebDNA Talk List <talk@webdna.us>
Subject: Re: [WebDNA] Upload file to mysql
What is the error ?
Kind regards
Stuart Tremain
Pharoah Lane Software
AUSTRALIA
On 21 Mar 2017, at 12:00, Brian Boegershausen <brian@endeavotech.com> wrote:
Mysql error.
Brian Boegershausen
On Mon, Mar 20, 2017 at 8:59 PM -0400, "Stuart Tremain" <webdna@idfk.com.au> wrote:
Brian, when you say it chokes, do you mean that WebDNA stalls or do you get a MySQL error message ?
Kind regards
Stuart Tremain
Pharoah Lane Software
AUSTRALIA
On 21 Mar 2017, at 11:15, <brian@endeavotech.com> <brian@endeavotech.com> wrote:
Hi Stewart,
I have my content field set to MEDIUMBLOB which allows for 16mb max files.
So far, I am using files around 100kb, so I am not reaching the max yet.
My query writes all the data fields and uploads .txt files, but once I change to a file like a PDF, it chokes.
[showif [referer]^file_manager.dna]
[showif [name]^filename]
[text show=F]TheFileNM=[Middle StartAfter=filename="&EndBefore="][name][/middle][/text]
[/showif]
[showif [name]^CPK]
[text show=F]CPK=[value][/text]
[/showif]
[showif [name]^JPK]
[text show=F]JPK=[value][/text]
[/showif]
[/FormVariables]
[hideif [TheFileNM]=]
[hideif [CPK]=]
[hideif [JPK]=]
[showif [name]^"thefile"]
[SQLExecute conn_ref=TheBlueBiller&result_var=UPLOAD_INS]
INSERT INTO UPLOAD
(FILE_ID, COMPANY_ID, CLIENT_ID, JOB_ID, NAME, CONTENT, ROW_ADDED_DTTM)
VALUES ('', '[LOGIN_COMPANY_ID]', '[CPK]', '[JPK]', '[TheFileNM]', '[convertchars db=databases/upload.db][value][/convertchars]', '[date %Y-%m-%d %H:%M:%S]')
[/SQLExecute]
[/showif]
[/FormVariables]
[/hideif]
[/hideif]
[/hideif]
[!]========UPLOAD.DB FILE------------[/!]
FROM TO
' \'
" \"
\ \\
% \%
From: Stuart Tremain [mailto:webdna@idfk.com.au]
Sent: Monday, March 20, 2017 6:43 PM
To: WebDNA Talk List <talk@webdna.us>
Subject: Re: [WebDNA] Upload file to mysql
Hi Brian
I have not done that, but providing your MySQL field is LONGBLOB all should work.
Also to be able to insert images that are bigger than 1MB you have to increase the max_allowed_packed option in the server configuration file.
I use Navicat to write all my queries and then copy & paset the query into my WebDNA doc. Navicat makes writing & debugging fast.
Kind regards
Stuart Tremain
Pharoah Lane Software
AUSTRALIA
On 21 Mar 2017, at 07:55, Brian Boegershausen <brian@endeavotech.com> wrote:
Anyone successfully upload a file to a mysql db?
I can upload a text file but that is it.
Jpg and gif fail.Unbuntu 14
Webdna 8.2
Mysql 5.5
Brian Boegershausen
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
Virus-free.
www.avg.com --------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
Virus-free.
www.avg.com --------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
Virus-free.
www.avg.com --------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us --------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
DOWNLOAD WEBDNA NOW!
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...