pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Zhidian Du <duzhidian@hotmail.com>
To: pgsql-php@postgresql.org
Subject: Are these steps correct and standard way to upload images into a table?
Date: Thu, 07 Nov 2002 21:32:00 -0700
Message-ID: <F90HfqR77bieLYCT4aJ00000036@hotmail.com> (raw)

I check the posts about uploading images from browser.  No one give me a 
whole procedure how to do it.  My friend told me I can upload binary/image 
file using following steps:

I want to know are these steps standard steps that insert images into a 
table?


Step 1 upload it
<FORM METHOD=POST ACTION="" enctype="multipart/form-data">
<tr><td>upload </TD><TD><input type="file" name="pic" 
size=40></td></tr></form>

<?
	if($pic_name != '')
	{
	$len = strlen($pic_name)-4;
	$ext = substr($pic_name,$len);
	$ext = strtolower($ext);

	$File="/www/pics/test".$ext;
	exec("cp $pic $File");
	}


?>

Step 2 Read it
$fd = fopen($img_name, "r");
        while ($post_file = fread($fd, 4096))
        {
         $filestuff .= $post_file;
        }
        fclose($fd);


Step 3 insert or update into the table using insert or update

Are these steps correct or the standard way to upload images into a table?

Thanks.

Zhidian Du



_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963




view thread (3+ messages)  latest in thread

Message-ID: <F90HfqR77bieLYCT4aJ00000036@hotmail.com>
Permalink:  ../F90HfqR77bieLYCT4aJ00000036@hotmail.com/
Also on:    postgresql.org/message-id/F90HfqR77bieLYCT4aJ00000036@hotmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: duzhidian@hotmail.com
  Subject: Re: Are these steps correct and standard way to upload images into a table?
  In-Reply-To: <F90HfqR77bieLYCT4aJ00000036@hotmail.com>
  References: <F90HfqR77bieLYCT4aJ00000036@hotmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox