NYCPHP Meetup

NYPHP.org

[nycphp-talk] regarding image

Rich Gray rich at f1central.net
Thu Jan 16 08:33:38 EST 2003


Hi Tracy

Not sure what you are trying to do but when a file is uploaded to a PHP
script by a form then the details are stored in the $_FILES array as
below...

$_FILES['userfile']['name']
The original name of the file on the client machine.

$_FILES['userfile']['type']
The mime type of the file, if the browser provided this information. An
example would be "image/gif".

$_FILES['userfile']['size']
The size, in bytes, of the uploaded file.

$_FILES['userfile']['tmp_name']
The temporary filename of the file in which the uploaded file was stored on
the server.

$_FILES['userfile']['error']
The error code associated with this file upload. ['error'] was added in PHP
4.2.0

Check the section on handling file uploads in the PHP manual and the
functions is_uploaded_file() and move_uploaded_file()
HTH
Rich

-----Original Message-----
From: Tracy [mailto:tech_learner at yahoo.com]
Sent: 16 January 2003 12:31
To: NYPHP Talk
Subject: [nycphp-talk] regarding image



HI,
I cant understand this:
in a script that is suposed to upload image, i have,
$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
echo $data;
for this i get the following 'echoed':
GIF89a¾X
‘\\0\\0Ê¢y`üá!ù\\0\\0\\0\\0\\0,\\0\\0\\0\\0¾X\\0ÿœ©Ëí£œ´Ú‹³Þ¼û†âH–扦êʶî
ÇòL×öçúÎ÷þ ‡Ä¢ñˆL*—̦ó J§ÔªõŠÍj·Ü®÷ ‹Çä²ùŒN«×ì¶û
ËçôºýŽÏë÷ü¾ÿ,(8HXhxˆ˜¨¸ÈØèø)9IYiy‰™©¹¨ð
why is it so?
is there some way where i can save the path of the image in the mysql
database? i mean, i upload a pict from the desktop and have the path to the
directory where i want to save the image. is there a way where i can have
the field in the mysql table as :
image_path
-----------
"the upload dir path i have specified " + "the image name"
so that i can use this as a link to display the image.
if there is a better way to achieve this, plz help me with it.
Thanks
Tracy
 Phil Powell <soazine at erols.com> wrote:Which is what happened until I put
the vars into a session variable, then
all was well! :)

Thanx
Phil
----- Original Message -----
From: "Analysis & Solutions"
To: "NYPHP Talk"
Sent: Thursday, January 16, 2003 2:07 AM
Subject: Re: [nycphp-talk] Problems with require and variables


> On Wed, Jan 15, 2003 at 11:35:27PM -0500, Phil Powell wrote:
> >
> > However, when display.php finishes being "required", I lose all of my
> > variables that I need for view.php. How do I retain them?? How can I
> > ensure that these variables in display.php will also exist in view.php?
>
> Once it's required, everything that's happened is still there. It's as if
> you had one big file rather than multiple smaller files.
>
> Chances are you are trying to use those variables in functions in which
> you didn't global the array.
>
> --Dan
>
> --
> PHP classes that make web design easier
> SqlSolution.info | LayoutSolution.info | FormSolution.info
> T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
> 4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
>
>
>
>
>







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Coming together is a beginning...
   keeping together is progress...
      working together is success !!!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


---------------------------------
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


--- Unsubscribe at http://nyphp.org/list/ ---







More information about the talk mailing list