DB cuts off data

I have a script which uploads an image to a db.

But when processed only one character is added from the file.

example

File added is F:\webserver\images\16466.gif

The result is db "F"

any ideas.
Dave Nash [ Do, 11 Januar 2007 09:23 ] [ ID #1592411 ]

Re: DB cuts off data

Dave Nash wrote:
> I have a script which uploads an image to a db.
>
> But when processed only one character is added from the file.
>
> example
>
> File added is F:\webserver\images\16466.gif
>
> The result is db "F"
>
> any ideas.

Maybe you set the column to only be 1 character.

--

//Aho
Shion [ Do, 11 Januar 2007 10:21 ] [ ID #1592412 ]

Re: DB cuts off data

On Thu, 11 Jan 2007 10:21:28 +0100, "J.O. Aho" <user [at] example.net>
wrote:

>Dave Nash wrote:
>> I have a script which uploads an image to a db.
>>
>> But when processed only one character is added from the file.
>>
>> example
>>
>> File added is F:\webserver\images\16466.gif
>>
>> The result is db "F"
>>
>> any ideas.
>
>Maybe you set the column to only be 1 character.

Its set to varchar 200 Collation utf8_bin Null = Yes
Dave Nash [ Do, 11 Januar 2007 10:27 ] [ ID #1592413 ]

Re: DB cuts off data

On Thu, 11 Jan 2007 20:27:15 +1100, Dave Nash <kabooby2004 [at] yahoo.com>
wrote:

>On Thu, 11 Jan 2007 10:21:28 +0100, "J.O. Aho" <user [at] example.net>
>wrote:
>
>>Dave Nash wrote:
>>> I have a script which uploads an image to a db.
>>>
>>> But when processed only one character is added from the file.
>>>
>>> example
>>>
>>> File added is F:\webserver\images\16466.gif
>>>
>>> The result is db "F"
>>>
>>> any ideas.
>>
>>Maybe you set the column to only be 1 character.
>
>Its set to varchar 200 Collation utf8_bin Null = Yes

Also are you up for a few hours work???
Dave Nash [ Do, 11 Januar 2007 10:33 ] [ ID #1592414 ]

Re: DB cuts off data

Message-ID: <7psbq21eearnra2fca2997q24k2flfhfoe [at] 4ax.com> from Dave Nash
contained the following:

>I have a script which uploads an image to a db.
Are you uploading the image or a reference to the image?
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow [ Do, 11 Januar 2007 11:14 ] [ ID #1592416 ]

Re: DB cuts off data

On Thu, 11 Jan 2007 10:14:27 +0000, Geoff Berrow
<blthecat [at] ckdog.co.uk> wrote:

>Message-ID: <7psbq21eearnra2fca2997q24k2flfhfoe [at] 4ax.com> from Dave Nash
>contained the following:
>
>>I have a script which uploads an image to a db.
>Are you uploading the image or a reference to the image?

Im uploading an imaeg to a folder and a reference to it in the db.
Its actually a script which is editing an existing image.

see below.

<?php

/* A function for moving file uploads, please make sure the
destination directory has directory permissions set (777) */

function move_upload( $file, $dest, $overwrite = false )
{

if ($file["error"] == UPLOAD_ERR_OK)
{
if(!file_exists( $dest.$file["name"] ) || $overwrite)
{
if (move_uploaded_file( $file["tmp_name"],
$dest.$file["name"] ))
{
$upload_feedback .= "The file " . $file["name"] .
" was successfully uploaded";
$error = FALSE;
}
else
{
$upload_feedback .= "The file " . $file["name"] .
" could not be moved";
$error = TRUE;
}
}
else
{
$upload_feedback .= "The file " . $file["name"] . "
already exists, please check the overwrite option if you wish to
replace it";
$error = TRUE;
}
}
else
{
switch ($file["error"])
{
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
$upload_feedback .= "The file " . $file["name"] .
" is to large to be uploaded
";
$error = TRUE;
break;

case UPLOAD_ERR_PARTIAL:
$upload_feedback .= "The file" . $file["name"] . "
was interrupted while uploading, please try again
";
$error = TRUE;
break;
}
}

return array( "error" => $error, "feedback" =>
$upload_feedback ); //return message plus error status
}

/* All of the uploaded images */
$image = $_FILES["image"];

/* Destination directory */
$destination = "../upload/";

/* Call the function to move the files */
move_upload( $image, $destination );
?>
<?php
$query="UPDATE categories SET catname='$ud_catname',
image='{$ud_image["name"]}', parentid='$parentid' WHERE
catid='$ud_catid'";
[at] mysql_select_db($database) or die( "Unable to select database");
mysql_query($query);
echo " <table width=\"100%\" border=\"0\" cellspacing=\"1\"
cellpadding=\"3\">
<tr>
<th scope=\"col\"><div align=\"left\" class=\"textstandard\">The
Category was succesfully edited</div></th>
</tr>
</table>";
?>
Dave Nash [ Do, 11 Januar 2007 11:21 ] [ ID #1592417 ]

Re: DB cuts off data

Dave Nash wrote:

> <?php
> $query="UPDATE categories SET catname='$ud_catname',
> image='{$ud_image["name"]}', parentid='$parentid' WHERE
> catid='$ud_catid'";
> [at] mysql_select_db($database) or die( "Unable to select database");
> mysql_query($query);
> echo " <table width=\"100%\" border=\"0\" cellspacing=\"1\"
> cellpadding=\"3\">
> <tr>
> <th scope=\"col\"><div align=\"left\" class=\"textstandard\">The
> Category was succesfully edited</div></th>
> </tr>
> </table>";
> ?>

Hi Dave,

You shouldn't surround values of numeric types with quotes in your query:

$query="UPDATE categories SET catname='$ud_catname',
image='{$ud_image["name"]}', parentid=$parentid WHERE
catid=$ud_catid";

Also echo your $query variable before executing it, to see what you're
sending to the database server. There's probably simply an error in your
$ud_image array.

Ruben.
DFS [ Do, 11 Januar 2007 11:55 ] [ ID #1592420 ]

Re: DB cuts off data

On Thu, 11 Jan 2007 11:55:30 +0100, Ruben van Engelenburg
<nospam [at] nospam.com> wrote:

>Dave Nash wrote:
>
>> <?php
>> $query="UPDATE categories SET catname='$ud_catname',
>> image='{$ud_image["name"]}', parentid='$parentid' WHERE
>> catid='$ud_catid'";
>> [at] mysql_select_db($database) or die( "Unable to select database");
>> mysql_query($query);
>> echo " <table width=\"100%\" border=\"0\" cellspacing=\"1\"
>> cellpadding=\"3\">
>> <tr>
>> <th scope=\"col\"><div align=\"left\" class=\"textstandard\">The
>> Category was succesfully edited</div></th>
>> </tr>
>> </table>";
>> ?>
>
>Hi Dave,
>
>You shouldn't surround values of numeric types with quotes in your query:
>
>$query="UPDATE categories SET catname='$ud_catname',
>image='{$ud_image["name"]}', parentid=$parentid WHERE
>catid=$ud_catid";
>
>Also echo your $query variable before executing it, to see what you're
>sending to the database server. There's probably simply an error in your
>$ud_image array.
>
>Ruben.

Call me silly but how do I echo the query?
Dave Nash [ Do, 11 Januar 2007 12:00 ] [ ID #1592422 ]

Re: DB cuts off data

Message-ID: <366cq2tppi7h9um7nj073nqr3v29u9jt82 [at] 4ax.com> from Dave Nash
contained the following:

>>$query="UPDATE categories SET catname='$ud_catname',
>>image='{$ud_image["name"]}', parentid=$parentid WHERE
>>catid=$ud_catid";
>>
>>Also echo your $query variable before executing it, to see what you're
>>sending to the database server. There's probably simply an error in your
>>$ud_image array.
>>
>>Ruben.
>
>Call me silly but how do I echo the query?

echo $query;

You echo it to the screen so you can see what it is evaluating to.

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow [ Do, 11 Januar 2007 12:14 ] [ ID #1592424 ]

Re: DB cuts off data

Dave Nash wrote:

> Call me silly but how do I echo the query?

Like this :)

$query="UPDATE categories SET catname='$ud_catname',
image='{$ud_image["name"]}', parentid='$parentid' WHERE catid='$ud_catid'";

echo $query;

Ruben.
DFS [ Do, 11 Januar 2007 12:15 ] [ ID #1592425 ]

Re: DB cuts off data

On Thu, 11 Jan 2007 12:15:18 +0100, Ruben van Engelenburg
<nospam [at] nospam.com> wrote:

>Dave Nash wrote:
>
>> Call me silly but how do I echo the query?
>
>Like this :)
>
>$query="UPDATE categories SET catname='$ud_catname',
>image='{$ud_image["name"]}', parentid='$parentid' WHERE catid='$ud_catid'";
>
>echo $query;
>
>Ruben.

Echo query =

UPDATE categories SET catname='Hockey Sticks', image='s',
parentid='43' WHERE catid='43'

but the image is called send-out1.jpg
Dave Nash [ Do, 11 Januar 2007 12:23 ] [ ID #1592427 ]

Re: DB cuts off data

Dave Nash schreef:
> On Thu, 11 Jan 2007 12:15:18 +0100, Ruben van Engelenburg
> <nospam [at] nospam.com> wrote:
>
>> Dave Nash wrote:
>>
>>> Call me silly but how do I echo the query?
>> Like this :)
>>
>> $query="UPDATE categories SET catname='$ud_catname',
>> image='{$ud_image["name"]}', parentid='$parentid' WHERE catid='$ud_catid'";
>>
>> echo $query;
>>
>> Ruben.
>
> Echo query =
>
> UPDATE categories SET catname='Hockey Sticks', image='s',
> parentid='43' WHERE catid='43'
>
> but the image is called send-out1.jpg

What is this $ud_image ? You are not referring ot it anywhere

try this at the end of ur script

var_dump($ud_image);
var_dump($_FILES);

--
Arjen
http://www.hondenpage.com - Mijn site over honden
Dave Williams [ Do, 11 Januar 2007 12:51 ] [ ID #1592429 ]

Re: DB cuts off data

On Thu, 11 Jan 2007 12:51:35 +0100, Arjen <dont [at] mail.me> wrote:

>Dave Nash schreef:
>> On Thu, 11 Jan 2007 12:15:18 +0100, Ruben van Engelenburg
>> <nospam [at] nospam.com> wrote:
>>
>>> Dave Nash wrote:
>>>
>>>> Call me silly but how do I echo the query?
>>> Like this :)
>>>
>>> $query="UPDATE categories SET catname='$ud_catname',
>>> image='{$ud_image["name"]}', parentid='$parentid' WHERE catid='$ud_catid'";
>>>
>>> echo $query;
>>>
>>> Ruben.
>>
>> Echo query =
>>
>> UPDATE categories SET catname='Hockey Sticks', image='s',
>> parentid='43' WHERE catid='43'
>>
>> but the image is called send-out1.jpg
>
>What is this $ud_image ? You are not referring ot it anywhere
>
>try this at the end of ur script
>
>var_dump($ud_image);
>var_dump($_FILES);

This is what I get back after adding your code.

F:\\webserver\\2006_11_November\\morgan_sports\\images\\butt ons\\morgan_sports_11.gifstring(85)
"F:\\webserver\\2006_11_November\\morgan_sports\\images\\but tons\\morgan_sports_11.gif"
array(0) { } UPDATE categories SET catname='Hockey Sticks', image='F',
parentid='43' WHERE catid='43'

ud_image is referenced is the previous form...

<input name="ud_image" type="file" class="form" id="image" />
Dave Nash [ Do, 11 Januar 2007 12:56 ] [ ID #1592430 ]

Re: DB cuts off data

> F:\\webserver\\2006_11_November\\morgan_sports\\images\\butt ons\\morgan_sports_11.gifstring(85)
> "F:\\webserver\\2006_11_November\\morgan_sports\\images\\but tons\\morgan_sports_11.gif"

I know what's wrong :-)

Take a good look at the var dump .. function and compare it with this

$lala =array('name'=>'file.jpg');
var_dump($lala);

//array(1) { ["name"]=> string(8) "file.jpg" }
--
Arjen
http://www.hondenpage.com - Mijn site over honden
Dave Williams [ Do, 11 Januar 2007 13:25 ] [ ID #1592438 ]

Re: DB cuts off data

On Thu, 11 Jan 2007 13:25:34 +0100, Arjen <dont [at] mail.me> wrote:

>> F:\\webserver\\2006_11_November\\morgan_sports\\images\\butt ons\\morgan_sports_11.gifstring(85)
>> "F:\\webserver\\2006_11_November\\morgan_sports\\images\\but tons\\morgan_sports_11.gif"
>
>I know what's wrong :-)
>
>Take a good look at the var dump .. function and compare it with this
>
>$lala =array('name'=>'file.jpg');
>var_dump($lala);
>
>//array(1) { ["name"]=> string(8) "file.jpg" }

Lost me a bit.

heres the code I have. what needs changing.

$query="UPDATE categories SET catname='$ud_catname',
image='{$ud_image["name"]}', parentid='$parentid' WHERE
catid='$ud_catid'";
[at] mysql_select_db($database) or die( "Unable to select database");
mysql_query($query);
var_dump($ud_image);
var_dump($_FILES);
Dave Nash [ Do, 11 Januar 2007 13:26 ] [ ID #1592439 ]

Re: DB cuts off data

Dave Nash schreef:
> On Thu, 11 Jan 2007 13:25:34 +0100, Arjen <dont [at] mail.me> wrote:
>
>>> F:\\webserver\\2006_11_November\\morgan_sports\\images\\butt ons\\morgan_sports_11.gifstring(85)
>>> "F:\\webserver\\2006_11_November\\morgan_sports\\images\\but tons\\morgan_sports_11.gif"
>> I know what's wrong :-)
>>
>> Take a good look at the var dump .. function and compare it with this
>>
>> $lala =array('name'=>'file.jpg');
>> var_dump($lala);
>>
>> //array(1) { ["name"]=> string(8) "file.jpg" }
>
> Lost me a bit.
>
> heres the code I have. what needs changing.
>
> $query="UPDATE categories SET catname='$ud_catname',
> image='{$ud_image["name"]}', parentid='$parentid' WHERE
> catid='$ud_catid'";
> [at] mysql_select_db($database) or die( "Unable to select database");
> mysql_query($query);
> var_dump($ud_image);
> var_dump($_FILES);
>
That code is ok. the array (as I understand it ... the var_dump output
doesn't seem complete)

To me it looks like ur array look like this

$file['filename.ext']="filename.ext";
insted of
$file['name']="filename.ext";

--
Arjen
http://www.hondenpage.com - Mijn site over honden
Dave Williams [ Do, 11 Januar 2007 13:38 ] [ ID #1592440 ]

Re: DB cuts off data

Message-ID: <i6bcq2t6ph91tg80pkovpsql8l0mfkrokk [at] 4ax.com> from Dave Nash
contained the following:

>
>heres the code I have. what needs changing.
>
>$query="UPDATE categories SET catname='$ud_catname',
>image='{$ud_image["name"]}', parentid='$parentid' WHERE
>catid='$ud_catid'";
> [at] mysql_select_db($database) or die( "Unable to select database");
>mysql_query($query);
>var_dump($ud_image);
>var_dump($_FILES);

The name of the image will be in the following variable
$_FILES['ud_image']['name']

therefore

$query="UPDATE categories SET catname='$ud_catname',
image='".$_FILES['ud_image']['name']."', parentid='$parentid' WHERE
catid='$ud_catid'";

should work.



--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow [ Do, 11 Januar 2007 13:47 ] [ ID #1592442 ]

Re: DB cuts off data

On Thu, 11 Jan 2007 12:47:12 +0000, Geoff Berrow
<blthecat [at] ckdog.co.uk> wrote:

>Message-ID: <i6bcq2t6ph91tg80pkovpsql8l0mfkrokk [at] 4ax.com> from Dave Nash
>contained the following:
>
>>
>>heres the code I have. what needs changing.
>>
>>$query="UPDATE categories SET catname='$ud_catname',
>>image='{$ud_image["name"]}', parentid='$parentid' WHERE
>>catid='$ud_catid'";
>> [at] mysql_select_db($database) or die( "Unable to select database");
>>mysql_query($query);
>>var_dump($ud_image);
>>var_dump($_FILES);
>
>The name of the image will be in the following variable
>$_FILES['ud_image']['name']
>
>therefore
>
>$query="UPDATE categories SET catname='$ud_catname',
>image='".$_FILES['ud_image']['name']."', parentid='$parentid' WHERE
>catid='$ud_catid'";
>
>should work.

ive tried this code and the following comes up... And it also clears
the exisitng variable in the 'image" fields of the db.

send-out1.jpgstring(13) "send-out1.jpg" array(0) { } UPDATE categories
SET catname='No Parent Category', image='', parentid='43' WHERE
catid='44'
Dave Nash [ Do, 11 Januar 2007 14:01 ] [ ID #1592444 ]

Re: DB cuts off data

Message-ID: <q5dcq21626a1qlnps69fi1uo63mfin6mot [at] 4ax.com> from Dave Nash
contained the following:

>>$query="UPDATE categories SET catname='$ud_catname',
>>image='".$_FILES['ud_image']['name']."', parentid='$parentid' WHERE
>>catid='$ud_catid'";
>>
>>should work.
>
>ive tried this code and the following comes up... And it also clears
>the exisitng variable in the 'image" fields of the db.

This is progress! :-) It means that variable is probably empty. It
shouldn't be.
>
>send-out1.jpgstring(13) "send-out1.jpg" array(0) { } UPDATE categories
>SET catname='No Parent Category', image='', parentid='43' WHERE
>catid='44'
Check you have out put in the $_FILES array by outputting it to screen

e.g.
print_r($_FILES);

also check you have set the form correctly

<FORM ENCTYPE="multipart/form-data" method="post" action="<wherever your
processing script lives>")

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow [ Do, 11 Januar 2007 14:25 ] [ ID #1592445 ]

Re: DB cuts off data

Geoff Berrow schreef:
> Message-ID: <i6bcq2t6ph91tg80pkovpsql8l0mfkrokk [at] 4ax.com> from Dave Nash
> contained the following:
>
>> heres the code I have. what needs changing.
>>
>> $query="UPDATE categories SET catname='$ud_catname',
>> image='{$ud_image["name"]}', parentid='$parentid' WHERE
>> catid='$ud_catid'";
>> [at] mysql_select_db($database) or die( "Unable to select database");
>> mysql_query($query);
>> var_dump($ud_image);
>> var_dump($_FILES);
>
> The name of the image will be in the following variable
> $_FILES['ud_image']['name']
>
> therefore
>
> $query="UPDATE categories SET catname='$ud_catname',
> image='".$_FILES['ud_image']['name']."', parentid='$parentid' WHERE
> catid='$ud_catid'";
>
> should work.

The $_FILES array was empty. My guess is that op is trying to pass
variables.

Arjen
http://www.hondenpage.com - Mijn site over honden
Dave Williams [ Do, 11 Januar 2007 14:26 ] [ ID #1592446 ]

Re: DB cuts off data

On Thu, 11 Jan 2007 13:25:30 +0000, Geoff Berrow
<blthecat [at] ckdog.co.uk> wrote:

>Message-ID: <q5dcq21626a1qlnps69fi1uo63mfin6mot [at] 4ax.com> from Dave Nash
>contained the following:
>
>>>$query="UPDATE categories SET catname='$ud_catname',
>>>image='".$_FILES['ud_image']['name']."', parentid='$parentid' WHERE
>>>catid='$ud_catid'";
>>>
>>>should work.
>>
>>ive tried this code and the following comes up... And it also clears
>>the exisitng variable in the 'image" fields of the db.
>
>This is progress! :-) It means that variable is probably empty. It
>shouldn't be.
>>
>>send-out1.jpgstring(13) "send-out1.jpg" array(0) { } UPDATE categories
>>SET catname='No Parent Category', image='', parentid='43' WHERE
>>catid='44'
>Check you have out put in the $_FILES array by outputting it to screen
>
>e.g.
>print_r($_FILES);
>
>also check you have set the form correctly
>
><FORM ENCTYPE="multipart/form-data" method="post" action="<wherever your
>processing script lives>")

ive made the changes and this is the following. Very close I think ;-)

Array ( [ud_image] => Array ( [name] => send-out1.jpg [type] =>
image/jpeg [tmp_name] => C:\WINDOWS\TEMP\php1D4.tmp [error] => 0
[size] => 182419 ) ) UPDATE categories SET catname='Hockey Sticks',
image='', parentid='43' WHERE catid='43'


My script is as follows.

$query="UPDATE categories SET catname='$ud_catname',
image='".$_FILES['image']['name']."', parentid='$parentid' WHERE
catid='$ud_catid'";
[at] mysql_select_db($database) or die( "Couldn't execute query: " .
mysql_error());
mysql_query($query);
print_r($_FILES);
Dave Nash [ Do, 11 Januar 2007 14:30 ] [ ID #1592447 ]

Re: DB cuts off data

Geoff Berrow schreef:
> Message-ID: <q5dcq21626a1qlnps69fi1uo63mfin6mot [at] 4ax.com> from Dave Nash
> contained the following:
>
>>> $query="UPDATE categories SET catname='$ud_catname',
>>> image='".$_FILES['ud_image']['name']."', parentid='$parentid' WHERE
>>> catid='$ud_catid'";
>>>
>>> should work.
>> ive tried this code and the following comes up... And it also clears
>> the exisitng variable in the 'image" fields of the db.
>
> This is progress! :-) It means that variable is probably empty. It

No it isn't we allready knew this !

> Check you have out put in the $_FILES array by outputting it to screen
>
> e.g.
> print_r($_FILES);


> var_dump($ud_image);
> >var_dump($_FILES);

F:\\webserver\\2006_11_November\\morgan_sports\\images\\butt ons\\morgan_sports_11.gifstring(85)
"F:\\webserver\\2006_11_November\\morgan_sports\\images\\but tons\\morgan_sports_11.gif"
array(0) { }


> also check you have set the form correctly
>
> <FORM ENCTYPE="multipart/form-data" method="post" action="<wherever your
> processing script lives>")
>


--
Arjen
http://www.hondenpage.com - Mijn site over honden
Dave Williams [ Do, 11 Januar 2007 14:33 ] [ ID #1592448 ]

Re: DB cuts off data

Message-ID: <esecq2donr49l6d22dfuk4ndfng9kll9dl [at] 4ax.com> from Dave Nash
contained the following:

>$query="UPDATE categories SET catname='$ud_catname',
>image='".$_FILES['image']['name']."', parentid='$parentid' WHERE
>catid='$ud_catid'";

No, that has to be $_FILES['ud_image']['name']

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow [ Do, 11 Januar 2007 14:35 ] [ ID #1592449 ]

Re: DB cuts off data

Message-ID: <eo5ec2$c3s$1 [at] brutus.eur.nl> from Arjen contained the
following:

>> This is progress! :-) It means that variable is probably empty. It
>
>No it isn't we allready knew this !

Well it isn't now. :-P

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow [ Do, 11 Januar 2007 14:38 ] [ ID #1592450 ]

Re: DB cuts off data

Message-ID: <eo5du6$c3l$1 [at] brutus.eur.nl> from Arjen contained the
following:

>The $_FILES array was empty. My guess is that op is trying to pass
>variables.


The op already said he was uploading a file.
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow [ Do, 11 Januar 2007 14:39 ] [ ID #1592451 ]

Re: DB cuts off data

On Thu, 11 Jan 2007 13:35:17 +0000, Geoff Berrow
<blthecat [at] ckdog.co.uk> wrote:

>Message-ID: <esecq2donr49l6d22dfuk4ndfng9kll9dl [at] 4ax.com> from Dave Nash
>contained the following:
>
>>$query="UPDATE categories SET catname='$ud_catname',
>>image='".$_FILES['image']['name']."', parentid='$parentid' WHERE
>>catid='$ud_catid'";
>
>No, that has to be $_FILES['ud_image']['name']

ive made this change and the db updates fine. wahoooo. thanks.

Tested live and works too.

Shoud I worry about this error in the output.

Array ( [ud_image] => Array ( [name] => button_08.gif [type] =>
image/gif [tmp_name] => /tmp/phpGmV8jp [error] => 0 [size] => 1154 ) )
UPDATE categories SET catname='Motorised scooters',
image='button_08.gif', parentid='43' WHERE catid='51'

cheers
David.
Dave Nash [ Do, 11 Januar 2007 14:40 ] [ ID #1592452 ]

Re: DB cuts off data

On Thu, 11 Jan 2007 13:39:52 +0000, Geoff Berrow
<blthecat [at] ckdog.co.uk> wrote:

>Message-ID: <eo5du6$c3l$1 [at] brutus.eur.nl> from Arjen contained the
>following:
>
>>The $_FILES array was empty. My guess is that op is trying to pass
>>variables.
>
>
>The op already said he was uploading a file.

ive just tested it again live and the image doesnt seemed to have
uploaded. It took a while for the page to process so I had assumed the
upload was ok.

ive gone through all folders in case it was uploaded to a differnet
dir but nothing argghhhh.
Dave Nash [ Do, 11 Januar 2007 14:46 ] [ ID #1592453 ]

Re: DB cuts off data

Message-ID: <kbfcq2tdv2l33ss7dr6fvdhu7a660saqg6 [at] 4ax.com> from Dave Nash
contained the following:

>Shoud I worry about this error in the output.

No. When [error] => 0 it means no error occurred.
http://uk.php.net/manual/en/features.file-upload.errors.php

>
>Array ( [ud_image] => Array ( [name] => button_08.gif [type] =>
>image/gif [tmp_name] => /tmp/phpGmV8jp [error] => 0 [size] => 1154 ) )
>UPDATE categories SET catname='Motorised scooters',
>image='button_08.gif', parentid='43' WHERE catid='51'

You can just comment out all that debugging stuff now. You could delete
it, but you may need it again.

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow [ Do, 11 Januar 2007 14:51 ] [ ID #1592454 ]

Re: DB cuts off data

Geoff Berrow schreef:
> Message-ID: <eo5du6$c3l$1 [at] brutus.eur.nl> from Arjen contained the
> following:
>
>> The $_FILES array was empty. My guess is that op is trying to pass
>> variables.
>
>
> The op already said he was uploading a file.

Yup but the $_FILES array was empty and the $ud_image array was filled.
Therefore he was passing variables wether he knew it or not :-)

--
Arjen
http://www.hondenpage.com - Mijn site over honden
Dave Williams [ Do, 11 Januar 2007 14:51 ] [ ID #1592455 ]

Re: DB cuts off data

Dave Nash schreef:

> Tested live and works too.

Great !

> Shoud I worry about this error in the output.

nope :-) Not al long as it is '0'
see http://nl2.php.net/manual/en/features.file-upload.errors.php

--
Arjen
http://www.hondenpage.com - Mijn site over honden
Dave Williams [ Do, 11 Januar 2007 14:53 ] [ ID #1592456 ]

Re: DB cuts off data

On Thu, 11 Jan 2007 14:53:46 +0100, Arjen <dont [at] mail.me> wrote:

>Dave Nash schreef:
>
>> Tested live and works too.
>
>Great !
>
>> Shoud I worry about this error in the output.
>
>nope :-) Not al long as it is '0'
>see http://nl2.php.net/manual/en/features.file-upload.errors.php

But the file isnt getting uploaded.


ive just tested it again live and the image doesnt seemed to have
uploaded. It took a while for the page to process so I had assumed the
upload was ok.

ive gone through all folders in case it was uploaded to a differnet
dir but nothing argghhhh.
Dave Nash [ Do, 11 Januar 2007 14:54 ] [ ID #1592458 ]

Re: DB cuts off data

Message-ID: <lrfcq2hqu4kb371ucmdvp4levjt5615acl [at] 4ax.com> from Dave Nash
contained the following:

>>The op already said he was uploading a file.
>
>ive just tested it again live and the image doesnt seemed to have
>uploaded. It took a while for the page to process so I had assumed the
>upload was ok.

probably this

$image = $_FILES["image"];

should be

$image = $_FILES["ud_image"];

You have to tell the function what image you are uploading. (ie the form
element name)
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow [ Do, 11 Januar 2007 15:02 ] [ ID #1592460 ]

Re: DB cuts off data

Message-ID: <eo5fds$cci$1 [at] brutus.eur.nl> from Arjen contained the
following:

>> The op already said he was uploading a file.
>
>Yup but the $_FILES array was empty and the $ud_image array was filled.
>Therefore he was passing variables wether he knew it or not :-)

Indeed. That's why I suspected the enctype. :-)

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow [ Do, 11 Januar 2007 15:04 ] [ ID #1592461 ]

Re: DB cuts off data

On Thu, 11 Jan 2007 14:04:26 +0000, Geoff Berrow
<blthecat [at] ckdog.co.uk> wrote:

>Message-ID: <eo5fds$cci$1 [at] brutus.eur.nl> from Arjen contained the
>following:
>
>>> The op already said he was uploading a file.
>>
>>Yup but the $_FILES array was empty and the $ud_image array was filled.
>>Therefore he was passing variables wether he knew it or not :-)
>
>Indeed. That's why I suspected the enctype. :-)

WOW. works great. thankyou so much Geoff and arjen. If you guys are
interested in some contract work drop me a line.

cheers
David.
Dave Nash [ Do, 11 Januar 2007 15:05 ] [ ID #1592462 ]

Re: DB cuts off data

Message-ID: <0agcq2hrumqcsk5ugvtr4l5dlhe82pfce8 [at] 4ax.com> from Geoff
Berrow contained the following:

>$image = $_FILES["image"];
>
>should be
>
>$image = $_FILES["ud_image"];

Actually, this was the crucial error. With this correct, (and the
enctype correct) you could have done

$query="UPDATE categories SET catname='$ud_catname',
image='{$image["name"]}', parentid='$parentid' WHERE
catid='$ud_catid'";


Soooo simple...<smacks head>

Now I really must get back to (paid) work :-)


--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow [ Do, 11 Januar 2007 15:12 ] [ ID #1592463 ]
PHP » alt.php » DB cuts off data

Vorheriges Thema: local works, but live doesnt.
Nächstes Thema: Well, The Save Button ~Sorta~ Works Now