This is a discussion on "uploading files" within the PHP Forum section. This forum, and the thread "uploading files are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
uploading files
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
hey everyone,
I'm having trouble uploading files using PHP to a MySQL database. I've viewed the help files but still can't work it out!! I've been stuck now for at least a week, can anyone help. the error message is as follows: Fatal error: Call to undefined function escape_data() in C:\Program Files\Apache Group\Apache2\test\php mysql\13\13\script_13_02.php on line 20 Here is my php code:
Can anyone help...., please. thank you in anticipation ziggi Last edited by karinne; May 23rd, 2007 at 13:53. Reason: Please use [php]...[/php] tags when displaying PHP code! |
|
|
|
|||
|
Re: uploading files
There isn't a standard php function called escape_data. What are you trying to do at that point in your code?
|
|
|||
|
Re: uploading files
Yup, grahame is right, escape_data() doesnt exist ... what are you trying to do and maybe one of us can give you the correct function.
Have you maybe got your languages mixed up.... mind you escape_data() doesnt ring any bells for me. |
|
|||
|
Problem solved!
Thanks for replying to my post guys it's really appreciated. I'm a web designer whose recently moved into development via PHP & MySQL. I've come across this e-commerce checkout script and have tried to edit it for my own purpose, so I really have no idea whether: escape_data() is common to PHP or not -being a novice I'll take your word that it isn't. However its aim is apparently to validate the information entered into text forms and escape any problematic characters. // Function for escaping and trimming form data. function escape_data ($data) { global $dbc; if (ini_get('magic_quotes_gpc')) { $data = stripslashes($data); } return mysql_real_escape_string (trim ($data), $dbc); } // End of escape_data() function. Adding this code solves the problem. But I now understand that in current versions of PHP 'Magic Quotes' are turned off by default in the php.ini file. So I'll have to check mine! Thanks again. |
|
||||
|
Re: uploading files
I actually recognize the function. It's used by Larry Ullman in the book I used as my introductory PHP text (PHP and MYSQL for Dynamic Websites) and AFAIK he wrote it.
There is an entire chapter in the book in which you construct an e-commerce site, and I'm betting a dollar your script originated there. It's an excellent book, btw. There's no need to wonder about magic quotes or anything else, and unless you are using a server on which you installed PHP yourself, the "default" settings are meaningless. Webhosts can and do establish defaults different from the PHP version. The easy solution: Save this tiny page as "phpinfo.php" in your public_html directory (preferably in a password protected administrative subdirectory):
|
|
|||
|
Re: uploading files
May I add my problem over here?
I made this code (or copied it from somewhere) it is working good! but I don't know my friend told me that "you cannot write HTML tags following the <?php tag and before the ?> tag." This is the code for uploading files:
|
|
||||
|
Re: uploading files
I don't know what your friend is talking about. Well, I guess he is saying you can't write
You can certainly have a <?php tag as the first code on a page. You can certainly write plain html as long as you are outside php tags. |
![]() |
| Tags |
| files, uploads |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Uploading Files to Personal Website? | brendonalexander | Website Planning | 4 | Feb 20th, 2008 18:31 |
| uploading files | Phixon | Flash & Multimedia Forum | 3 | Nov 14th, 2007 11:43 |
| Uploading various image files | Paula | ASP.NET Forum | 1 | Oct 7th, 2006 20:39 |
| files not uploading | skyfire400 | Hosting & Domains | 1 | Mar 4th, 2006 18:30 |
| Uploading of files | gwx03 | Implemented Suggestions | 6 | Dec 24th, 2003 21:51 |