RE: upload image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Maybe this will help you:

$name = mysql_escape_string($_POST['doc_filename'][$key]);
$author = mysql_escape_string($_POST['doc_filename_author'][$key]);
$filename = mysql_escape_string($value);
$filetype = mysql_escape_string($_FILES['doc_attach']['type'][$key]);
$filesize = mysql_escape_string($_FILES['doc_attach']['size'][$key]);
$filedata = addslashes (fread(fopen
($_FILES['doc_attach']['tmp_name'][$key], "r"),
filesize($_FILES['doc_attach']['tmp_name'][$key])));

					
$Query = "INSERT INTO filestorage (name, author, filename, filetype,
filesize, filedata) VALUES ('$name', '$author', '$filename', '$filetype',
'$filesize', '{$filedata}')";

/Peter



-----Original Message-----
From: Sonja [mailto:sonja@xxxxxxxxxxxxxx] 
Sent: Thursday, August 24, 2006 2:38 PM
To: php-general@xxxxxxxxxxxxx
Subject:  upload image


Hi,

I have problems with uploading image, here is the code

if(isset($_POST['txtTitle']))
{
	$albumId   = $_POST['cboAlbum'];
	$imgTitle  = $_POST['txtTitle'];
	$imgDesc   = $_POST['mtxDesc'];

	$images    = uploadImage('fleImage', GALLERY_IMG_DIR);

	if ($images['image'] == '' && $images['thumbnail'] == '') {
		echo "Error uploading file";
		exit;
	}
	
	$image     = $images['image'];
	$thumbnail = $images['thumbnail'];
	
	if (!get_magic_quotes_gpc()) {
        $albumName  = addslashes($albumName);
        $albumDesc  = addslashes($albumDesc);
        $imgPath    = addslashes($imgPath);
    }  

	$sql = "INSERT INTO tbl_image (im_album_id, im_title,
im_description,
im_image, im_thumbnail, im_date) 
			VALUES ($albumId, '$imgTitle', '$imgDesc', '$image',
'$thumbnail',
NOW())";

    mysql_query($sql) or die('Error, add image failed : ' . mysql_error());

    
    echo
"<script>window.location.href='index.php?page=list-image&album=$albumId';</s
cript>";
	exit;
} 

when I upload a picture return me error uploadin image.

Thanks	

-- 
View this message in context:
http://www.nabble.com/upload-image-tf2157181.html#a5959218
Sent from the PHP - General forum at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux