954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

image upload problem



Image title or caption

Your user name:

Upload image:



 




rime
Newbie Poster
24 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 

You said that your code output is:

Array ( [image_filename] => Array ( [name] => little-baby-monkeys.jpg [type] => image/pjpeg [tmp_name] => C:\PHP\uploadtemp\php1839.tmp [error] => 0 [size] => 105075 ) )


And it's pretty obvious that the:

print_r($_FILES);

function would print this output.
What is your actual problem?


!!!

mostafadotnet
Junior Poster
157 posts since Jul 2006
Reputation Points: 55
Solved Threads: 11
 

<?php include("dbcon.php"); ?> //db settings here
<?php
//--------------------------------------------------------------------------------
$path = "D:\websites\mysite.com\Uploads\\";
$web = "../uploads/";
$nopic = "../images/nopic.jpg";
$ad = "add_item";
$no = "1";
$page = $ad.$no;
//--------------------------------------------------------------------------------
$isim = $_REQUEST['NewsID']; // isim stands for renaming.
$tip = $_FILES[img1][type]; // tip = type
$size = $_FILES[img1][size];
//--------------------------------------------------------------------------------
$Edit = $_COOKIE['Edit'.$no];
if($Edit != "")
{
$GetID = "select * from news where NewsID='" . $isim . "'";
$FindID=mysql_query($GetID);
while($WriteID = mysql_fetch_array($FindID))
{
if($WriteID['Resim'.$no] != "")
{
setcookie('Edit'.$no,'');
$dosya = $WriteID['Resim'.$no];
}
else
{
setcookie('Edit'.$no,'');
$dosya = $nopic;
}
}
}
//--------------------------------------------------------------------------------
elseif($size >= 150000)
{
$dosya = $nopic;
//Temizle
$sil1 = $isim."_".$no.".jpg";
$sil2 = $isim."_".$no.".png";
$sil3 = $isim."_".$no.".gif";
@unlink($path.$sil1);
@unlink($path.$sil2);
@unlink($path.$sil3);
$uyari = "Max 150Kb";
}
//--------------------------------------------------------------------------------
elseif($tip == "image/jpeg" || $tip == "image/pjpeg")
{
$dosya = $isim."_".$no.".jpg";
//Temizle
$sil1 = $isim."_".$no.".jpg";
$sil2 = $isim."_".$no.".png";
$sil3 = $isim."_".$no.".gif";
@unlink($path.$sil1);
@unlink($path.$sil2);
@unlink($path.$sil3);
// Veritabanina Yaz
$query = "update news set Resim". $no ." ='" . $dosya . "' where NewsID=". $isim ."";
mysql_query($query) or die(mysql_error());
//Kopyala
@copy($_FILES[img1][tmp_name],$path.$dosya);

}

i wrote this one last year and still use it... dont say pls, it doesnt work.

fatihpiristine
Posting Whiz in Training
283 posts since Sep 2007
Reputation Points: 6
Solved Threads: 19
 

You said that your code output is:

Array ( [image_filename] => Array ( [name] => little-baby-monkeys.jpg [type] => image/pjpeg [tmp_name] => C:\PHP\uploadtemp\php1839.tmp [error] => 0 [size] => 105075 ) )

And it's pretty obvious that the:

print_r($_FILES);

function would print this output. What is your actual problem?

!!!


My problem is that it is not uploading any images

rime
Newbie Poster
24 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 

Did you find the answer to your problem? i have the same error and i haven't find any solution please help.

fedderico10
Newbie Poster
11 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You