Image upload problem

Reply

Join Date: Sep 2009
Posts: 6
Reputation: Jeyush is an unknown quantity at this point 
Solved Threads: 0
Jeyush Jeyush is offline Offline
Newbie Poster

Image upload problem

 
0
  #1
Oct 1st, 2009
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.

  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!
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 10
Reputation: rahul.anand77 is an unknown quantity at this point 
Solved Threads: 0
rahul.anand77 rahul.anand77 is offline Offline
Newbie Poster

Re: Image upload problem

 
0
  #2
Oct 1st, 2009
Hi, Please check the path. and then proceed. I hope the problem is in Path.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 6
Reputation: Jeyush is an unknown quantity at this point 
Solved Threads: 0
Jeyush Jeyush is offline Offline
Newbie Poster

Re: Image upload problem

 
0
  #3
Oct 2nd, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 225
Reputation: ayesha789 is an unknown quantity at this point 
Solved Threads: 3
ayesha789's Avatar
ayesha789 ayesha789 is offline Offline
Posting Whiz in Training

Re: Image upload problem

 
0
  #4
Oct 2nd, 2009
Ayesha
Reply With Quote Quick reply to this message  
Reply

Tags
image, problem, subdomain, upload

Message:




Views: 871 | Replies: 3
Thread Tools Search this Thread



Tag cloud for image, problem, subdomain, upload
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC