Help! Basic code problem
am 11.08.2007 04:18:56 von Big Moxy
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!!
method="POST">
Here is image_upload.php -
Upload Image
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"] . "
";
}
else
{
echo "No errors" . "
";
echo $uploaddir . "
";
echo $uploadfile . "
";
}
?>
Re: Help! Basic code problem
am 11.08.2007 04:51:25 von Jerry Stuckle
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!!
>
>
> method="POST">
>
>
>
> Here is image_upload.php -
>
>
>
>
>
> Upload Image
>
>
> 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"] . "
";
> }
> else
> {
> echo "No errors" . "
";
> echo $uploaddir . "
";
> echo $uploadfile . "
";
> }
> ?>
>
>
>
>
Enable all errors and turn on display errors in your php.ini file. I'll
bet it helps you find your problem.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Help! Basic code problem
am 11.08.2007 05:14:20 von Jerry Stuckle
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!!
>
>
> method="POST">
>
>
>
> Here is image_upload.php -
>
>
>
>
>
> Upload Image
>
>
> 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"] . "
";
> }
> else
> {
> echo "No errors" . "
";
> echo $uploaddir . "
";
> echo $uploadfile . "
";
> }
> ?>
>
>
>
>
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.
jstucklex@attglobal.net
==================
Re: Help! Basic code problem
am 11.08.2007 14:37:12 von Big Moxy
On Aug 10, 9:14 pm, Jerry Stuckle 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!!
>
> >
> > method="POST">
> >
> >
>
> > Here is image_upload.php -
>
> >
> >
> >
> >
> > Upload Image
> >
> >
> > 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"] . "
";
> > }
> > else
> > {
> > echo "No errors" . "
";
> > echo $uploaddir . "
";
> > echo $uploadfile . "
";
> > }
> > ?>
> >
> >
> >
>
> 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?
Re: Help! Basic code problem
am 11.08.2007 14:51:28 von Big Moxy
On Aug 11, 6:37 am, Big Moxy wrote:
> On Aug 10, 9:14 pm, Jerry Stuckle 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!!
>
> > >
> > > method="POST">
> > >
> > >
>
> > > Here is image_upload.php -
>
> > >
> > >
> > >
> > >
> > > Upload Image
> > >
> > >
> > > 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"] . "
";
> > > }
> > > else
> > > {
> > > echo "No errors" . "
";
> > > echo $uploaddir . "
";
> > > echo $uploadfile . "
";
> > > }
> > > ?>
> > >
> > >
> > >
>
> > 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-c heck/
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!
Re: Help! Basic code problem
am 11.08.2007 14:53:08 von Bucky Kaufman
Big Moxy wrote:
>>> error_reporting(E_ALL);
>>> $uploaddir = "d:\domains\test.com\wwwroot\casper\uploads\";
>>> $uploadfile = $uploaddir . basename($_FILES["userfile"]["name"]);
Your problem is in how you're using the backslash. In order to use a
back-slash in a string, you have to use TWO, not just one.
Like this:
$uploaddir = "d:\\domains\\test.com\\wwwroot\\casper\\uploads\\";
Re: Help! Basic code problem
am 11.08.2007 15:51:52 von Jerry Stuckle
Big Moxy wrote:
> On Aug 11, 6:37 am, Big Moxy wrote:
>> On Aug 10, 9:14 pm, Jerry Stuckle 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!!
>>>>
>>>> method="POST">
>>>>
>>>>
>>>> Here is image_upload.php -
>>>>
>>>>
>>>>
>>>>
>>>> Upload Image
>>>>
>>>>
>>>> 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"] . "
";
>>>> }
>>>> else
>>>> {
>>>> echo "No errors" . "
";
>>>> echo $uploaddir . "
";
>>>> echo $uploadfile . "
";
>>>> }
>>>> ?>
>>>>
>>>>
>>>>
>>> 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-c heck/
> 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!
>
Yes, forward slashes are standard - and understood in both Windows and
Unix. Unix doesn't understand backslashes. If you want to use
backslashes, double them up, i.e. "d:\\domains...".
And if you're going to do PHP development, you need a development system
where you can do these things. I highly recommend you install WAMP
(Windows, Apache, MySQL, PHP) on your own system. It goes quickly and
gives you a system you can develop and test on. Trying to debug
something like this when you don't have that control is both frustrating
and time-wasting.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Help! Basic code problem
am 11.08.2007 23:32:56 von Csaba
"Big Moxy" wrote in message
news:1186798736.635026.119060@q4g2000prc.googlegroups.com...
> 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
.... snip ..
>
>
Your page body is empty, meaning "blank page".
R.