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!

Recommended Answers

All 4 Replies

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

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.

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..!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.