944,123 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 2085
  • PHP RSS
Oct 1st, 2009
0

Image upload problem

Expand Post »
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.

PHP Syntax (Toggle Plain Text)
  1. $numfilesuploaded = $_POST['numuploads'];
  2. $count = 1;
  3.  
  4. while ($count <= $numfilesuploaded)
  5. {
  6. $conname = "new_file".$count;
  7.  
  8. $filetype = $_FILES[$conname]['type'];
  9.  
  10. $filename = $_FILES[$conname]['name'];
  11.  
  12. if ($filename != '')
  13. {
  14. if ($filetype == "image/x-png" || $filetype == "image/pjpeg" ||
  15.  
  16. $filetype == "image/gif" || $filetype == "image/jpeg")
  17. {
  18. $maxfilesize = $_POST['maxsize'];
  19. $filesize = $_FILES[$conname]['size'];
  20. if($filesize <= $maxfilesize )
  21. {
  22. $randomdigit = rand(0000,9999);
  23.  
  24. $newfilename = $randomdigit.$filename;
  25. $source = $_FILES[$conname]['tmp_name'];
  26. $target = "upload/project/".$newfilename;
  27. move_uploaded_file($source, $target);
  28. $sql_update =
  29.  
  30. "UPDATE project SET
  31.  
  32.  
  33. photo".$count." = '".$newfilename."',
  34.  
  35.  
  36. modified_date = now()
  37.  
  38.  
  39. WHERE project_id = '".$str_project_id."' ";
  40. tep_db_query($sql_update,
  41.  
  42. $conn);
  43. }
  44. else
  45. {
  46. echo $count." File is too big! 10MB limit! |";
  47.  
  48. }
  49. }
  50. else
  51. {
  52. echo " The file is not a supported type |";
  53. }
  54. }
  55. $count = $count + 1;
  56. }

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

Thanks for read my post!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Jeyush is offline Offline
10 posts
since Sep 2009
Oct 1st, 2009
0

Re: Image upload problem

Hi, Please check the path. and then proceed. I hope the problem is in Path.
Reputation Points: 8
Solved Threads: 0
Newbie Poster
rahul.anand77 is offline Offline
10 posts
since Sep 2008
Oct 2nd, 2009
0

Re: Image upload problem

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.
Last edited by Jeyush; Oct 2nd, 2009 at 1:37 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Jeyush is offline Offline
10 posts
since Sep 2009
Oct 2nd, 2009
0

Re: Image upload problem

Reputation Points: 17
Solved Threads: 6
Posting Pro in Training
ayesha789 is offline Offline
485 posts
since Jun 2009
Oct 28th, 2010
0
Re: Image upload problem
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..!!!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jamal_jarrar is offline Offline
2 posts
since Oct 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: [php] - showing time for user timezone
Next Thread in PHP Forum Timeline: Help with Security !





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC