1 Replies - 1831 Views - Last Post: 13 February 2006 - 06:44 AM Rate Topic: -----

#1 torsoman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 10-February 06

Help on uploading images with php please

Posted 10 February 2006 - 03:19 PM

hi...ive got big problm to save an image.the image upload sucesfuly but got errors when i want to save the image.can u help me?how to view the image tht i already saved?


[mod edit]Split off of the tutorial "Upload A File From A Form".

This post has been edited by hotsnoj: 10 February 2006 - 11:36 PM

Is This A Good Question/Topic? 0
  • +

Replies To: Help on uploading images with php please

#2 gayatri  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 62
  • Joined: 13-February 06

Re: Help on uploading images with php please

Posted 13 February 2006 - 06:44 AM

<?php
//$uploaddir=dir name
$uploadfile=$uploaddir.basename($_FILES["userfile"]["tmp_name"]);
if(trim(basename($_FILES["userfile"]["tmp_name"]))=='')
{
	$messageFail .= "Please select a file<BR>";
	continue;
}
if( trim($_FILES["userfile"]["tmp_name"])==0 )
{
	$messageFail .= "Error attaching file : Please Re-attach.<BR>";
	continue;
}

if(!@copy($_FILES["userfile"]["tmp_name"]), $uploadfile))
{
	$messageFail .="Could not upload the file:".$_FILES["userfile"]["tmp_name"]."<br />";
}
else
{
	$messageSuccess .= "Uploaded : ".$_FILES["userfile"]["tmp_name"]."<br />";
}
echo $messageFail;
echo $messageSuccess;
?>

//with referance to http://forums.dreami...=0&#entry144373

i assure u that this will help u to chk out where the error occurs in uploading n hope it solves ur probs

[mod edit] added [code] tags.

This post has been edited by hotsnoj: 13 February 2006 - 10:48 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1