problem uploading a picture

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

orrrrrrrr........ use a relative path :idea:
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
franknu
Forum Contributor
Posts: 146
Joined: Sun May 28, 2006 9:29 am

Post by franknu »

ok changes made

same result

code

Code: Select all

<?php


 

 


 $uploaddir = realpath ("C://Program Files//EasyPHP1-8//home//townsfinder//biz.pictures//"); 
 $uploadfile = $uploaddir . basename($_FILES['Picture1']['name']);




if(!empty($_FILES['Picture1'])) 
 { 
    var_dump($uploaddir); 
    var_dump($_FILES); 
        var_dump($_FILES['Picture1']['size']); 
    var_dump($_FILES['Picture1']['error']); 
    var_dump($_FILES['Picture1']['type']); 
      }

   if (move_uploaded_file($_FILES['Picture1']['tmp_name'], $uploaddir .$_FILES['Picture1']['name'])) 
    
    { 
       echo("File Uploaded"); 
   } 
    
   else 
    
   { 
       echo ("file no uploaded!"); 
	   print_r($_FILES);
	   echo realpath('./'); 
   } 


  

?>
here is my display

Code: Select all

bool(false) array(1) { ["Picture1"]=> array(5) { ["name"]=> string(11) "beer1_l.jpg" ["type"]=> string(11) "image/pjpeg" ["tmp_name"]=> string(41) "C:/Program Files/EasyPHP1-8\tmp\phpA4.tmp" ["error"]=> int(0) ["size"]=> int(3859) } } int(3859) int(0) string(11) "image/pjpeg" File Uploaded
franknu
Forum Contributor
Posts: 146
Joined: Sun May 28, 2006 9:29 am

Post by franknu »

made some changes

and now i am displaying something diffrence..

my code

Code: Select all

<?php

 $uploaddir = realpath ("C://Program Files//EasyPHP1-8//home//townsfinder//"); 
 $uploadfile = $uploaddir . basename($_FILES['Picture1']['name']);

if(!empty($_FILES['Picture1'])) 
 { 
    var_dump($uploaddir); 
    var_dump($_FILES); 
    var_dump($_FILES['Picture1']['size']); 
    var_dump($_FILES['Picture1']['error']); 
    var_dump($_FILES['Picture1']['type']); 
      }

   if (move_uploaded_file($_FILES['Picture1']['tmp_name'], $uploaddir .$_FILES['Picture1']['name'])) 
    
    { 
       echo("File Uploaded"); 
   } 
    
   else 
    
   { 
       echo ("file no uploaded!"); 
	   print_r($_FILES);
	   echo realpath('./'); 
   } 


  

?>





my display

Code: Select all

string(44) "C:\Program Files\EasyPHP1-8\home\townsfinder" array(1) { ["Picture1"]=> array(5) { ["name"]=> string(11) "beer1_l.jpg" ["type"]=> string(11) "image/pjpeg" ["tmp_name"]=> string(41) "C:/Program Files/EasyPHP1-8\tmp\phpC0.tmp" ["error"]=> int(0) ["size"]=> int(3859) } } int(3859) int(0) string(11) "image/pjpeg" File Uploaded
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Have you read the manual on what realpath() does?
Post Reply