Jump to content


Photo

problem uploading a picture


  • Please log in to reply
3 replies to this topic

#1 franknu

franknu
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts

Posted 20 October 2006 - 03:43 PM

ok i want to upload a picture along some info. i have this code working before, but it seems that the picture was being saved in the database so i made some changes to save only the path in the database

now it looks like it uploads the file but i cant find it anywhere. it is not in the database or folder
can anyone pelease why it is doin that

	<?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['Picture1']['size']); 
    var_dump($_FILES['Picture1']['error']); 
    var_dump($_FILES['Picture1']['type']); 
	var_dump($_FILES['Picture1']['name']);
	
      }

   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('./'); 
   } 


  

?> 

this is my display:    string(44) "C:\Program Files\EasyPHP1-8\home\townsfinder" int(19063) int(0) string(11) "image/pjpeg" string(8) "4c_1.jpg" File Uploaded

#2 Psycho

Psycho
  • Moderators
  • Move along, nothing to see here
  • 11,892 posts
  • LocationCanada

Posted 20 October 2006 - 04:09 PM

The $upload directory that is being returned does not have a backslash at the end. Perhaps the $uploadfile variable is not correct. Try displaying that on the page for debuggin purposes.
The quality of the responses received is directly proportional to the quality of the question asked.

I do not always test the code I provide, so there may be some syntax errors. In 99% of all cases I found the solution to your problem here: http://www.php.net

#3 franknu

franknu
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts

Posted 20 October 2006 - 05:40 PM

i did a echo on the directories and it it telling me that it is going there

here is what is saying

"C:\Program Files\EasyPHP1-8\home\townsfinder" int(19370) int(0) string(11) "image/pjpeg" string(22) "apple-bottom-jeans.jpg" File UploadedC:\Program Files\EasyPHP1-8\home\townsfinderC:\Program Files\EasyPHP1-8\home\townsfinderapple-bottom-jeans.jpg

see it is telling it has been uploaded here:

C:\Program Files\EasyPHP1-8\home\townsfinder

#4 franknu

franknu
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts

Posted 20 October 2006 - 05:50 PM

could be the space in C:\Program Files\  i tried renaming it but i couldnt it

i change to another folder and it says bool(false) which is a good sign meaning this is bring in the picture and putting somewhere.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users