Jump to content

Archived

This topic is now archived and is closed to further replies.

franknu

problem uploading a picture

Recommended Posts

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
[code=php:0]

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


 

?>
[/code]

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.