954,585 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

Hi buddy,

I have small script which upload the images. This script is working perfectly fine in

localhost but when I upload that script to my website then it is not uploading the pictures.

I have subdomain in my website names as http://projects.abc.com ,

In projects folder I have my photo upload script.

Here I add some code from my file.

$numfilesuploaded = $_POST['numuploads'];
      $count = 1;
 
          while ($count <= $numfilesuploaded)
          {
                  $conname = "new_file".$count;

                   $filetype = $_FILES[$conname]['type'];

                   $filename = $_FILES[$conname]['name'];

                  if ($filename != '')
                  {
                    if ($filetype == "image/x-png" || $filetype == "image/pjpeg" || 

$filetype == "image/gif" || $filetype == "image/jpeg")
                    {
                        $maxfilesize = $_POST['maxsize'];
                        $filesize = $_FILES[$conname]['size'];
                        if($filesize <= $maxfilesize )
                        {
                              $randomdigit = rand(0000,9999);
                             
                              $newfilename = $randomdigit.$filename;
                              $source = $_FILES[$conname]['tmp_name'];
                              $target = "upload/project/".$newfilename;
                              move_uploaded_file($source, $target);
							 	$sql_update		=	

"UPDATE project SET
												

		photo".$count." = '".$newfilename."',
												

		modified_date = now()	
												

	WHERE project_id	=	'".$str_project_id."' ";	
								tep_db_query($sql_update, 

$conn);
                        }
                        else
                        {
                            echo $count." File is too big! 10MB limit! |";
                        
                        }
                    }
                    else
                    {
                        echo " The file is not a supported type |";
                    }
                  }
          $count = $count + 1;
          }


If you have some sort of solution then please help me.

Thanks for read my post!

Jeyush
Newbie Poster
10 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

Hi, Please check the path. and then proceed. I hope the problem is in Path.

rahul.anand77
Newbie Poster
10 posts since Sep 2008
Reputation Points: 8
Solved Threads: 0
 

When I echo that target path it show me the full path like this,

http://projects.abc.com/upload/project/image-name , and that update query run successfully and add the new name of the image in database but no photo uploaded in the desire location.

Jeyush
Newbie Poster
10 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 
ayesha789
Posting Pro in Training
496 posts since Jun 2009
Reputation Points: 17
Solved Threads: 7
 

hi all i wont someone to help me that i make system but am stop that i wont a code to prodram butoon to upload picture but i nee form style and the code please help me ... thnks..!!!

jamal_jarrar
Newbie Poster
2 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: