You are here: Re: Help! Basic code problem « PHP Programming Language « IT news, forums, messages
Re: Help! Basic code problem

Posted by Big Moxy on 08/11/07 12:51

On Aug 11, 6:37 am, Big Moxy <bigm...@gmail.com> wrote:
> On Aug 10, 9:14 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>
>
>
>
>
> > Big Moxy wrote:
> > > This is stupid but I don't see the problem. I get a blank page when I
> > > submit this form. The files that I am using for testing are all less
> > > than 50 KB in size.
>
> > > Any insight is appreciated!!
>
> > > <form enctype="multipart/form-data" action="image_upload.php"
> > > method="POST">
> > > <table width="100%" border="0" cellpadding="3">
> > > <tr>
> > > <td>&nbsp;</td>
> > > </tr>
> > > <tr>
> > > <td><!-- The data encoding type, enctype, MUST be specified as
> > > below -->
> > > <!-- MAX_FILE_SIZE must precede the file input field -->
> > > <input type="hidden" name="MAX_FILE_SIZE" value="50000" />
> > > <!-- Name of input element determines name in $_FILES array -->
> > > Choose a file to upload:
> > > <input name="userfile" type="file" size="40" />
> > > </td>
> > > </tr>
> > > <tr>
> > > <td align="center"><input type="submit" name="Submit" id="Submit"
> > > value="Upload" /></td>
> > > </tr>
> > > </table>
> > > </form>
>
> > > Here is image_upload.php -
>
> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
> > >www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > > <html xmlns="http://www.w3.org/1999/xhtml">
> > > <head>
> > > <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
> > > <title>Upload Image</title>
> > > </head>
> > > <?php
> > > error_reporting(E_ALL);
> > > $uploaddir = "d:\domains\test.com\wwwroot\casper\uploads\";
> > > $uploadfile = $uploaddir . basename($_FILES["userfile"]["name"]);
> > > if ($_FILES["userfile"]["error"] > 0)
> > > {
> > > echo "Return Code: " . $_FILES["userfile"]["error"] . "<br />";
> > > }
> > > else
> > > {
> > > echo "No errors" . "<br />";
> > > echo $uploaddir . "<br />";
> > > echo $uploadfile . "<br />";
> > > }
> > > ?>
> > > <body>
> > > </body>
> > > </html>
>
> > I should add - you can also set display_errors in your file with
> > ini_set(). However, I recommend the php.ini file because
> > error_reporting() and ini_set() don't get executed when you have a fatal
> > (i.e. syntax) error.
>
> > --
> > ==================
> > Remove the "x" from my email address
> > Jerry Stuckle
> > JDS Computer Training Corp.
> > jstuck...@attglobal.net
> > ==================- Hide quoted text -
>
> > - Show quoted text -
>
> This code is running at my web host so I don't have access to php.ini.
> Is there another way?- Hide quoted text -
>
> - Show quoted text -

I found an online syntax checker - http://www.meandeviation.com/tutorials/learnphp/php-syntax-check/
that identified my problem. PHP didn't like the backslashes in my
folder definition.

$uploaddir = "d:\domains\test.com\wwwroot\casper\uploads\";

Is it a standard to always use a forward slash? How would I code a
backslash if it was every needed?

Thank you!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация