Would the file size affect the upload?

Thread Solved

Join Date: Feb 2008
Posts: 478
Reputation: maydhyam is an unknown quantity at this point 
Solved Threads: 1
maydhyam's Avatar
maydhyam maydhyam is offline Offline
Posting Pro in Training

Would the file size affect the upload?

 
0
  #1
Jun 13th, 2008
I have a concern about my program....the files that I want uploaded vary n size....would that affect the upload?
I did not set anything anywhere to enforce the file size to be uploaded, and only really small files are able to upload...
The man who in view of gain thinks of righteousness; who in the view of danger is prepared to give up his life; and who does not forget an old agreement however far back it extends - such a man may be reckoned a complete man.
~ Confucius, The Confucian Analects
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,744
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 330
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: Would the file size affect the upload?

 
0
  #2
Jun 13th, 2008
Php has a default upload size of 2mb. You need to change your php.ini file to increase it.
This might be of some help!
http://us3.php.net/manual/en/ini.cor....post-max-size
http://us3.php.net/manual/en/ini.cor...d-max-filesize
and
http://us3.php.net/features.file-upload
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 478
Reputation: maydhyam is an unknown quantity at this point 
Solved Threads: 1
maydhyam's Avatar
maydhyam maydhyam is offline Offline
Posting Pro in Training

Re: Would the file size affect the upload?

 
0
  #3
Jun 13th, 2008
okie dokie....I see I got some reading to do...
Will keep you posted...
The man who in view of gain thinks of righteousness; who in the view of danger is prepared to give up his life; and who does not forget an old agreement however far back it extends - such a man may be reckoned a complete man.
~ Confucius, The Confucian Analects
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 478
Reputation: maydhyam is an unknown quantity at this point 
Solved Threads: 1
maydhyam's Avatar
maydhyam maydhyam is offline Offline
Posting Pro in Training

Re: Would the file size affect the upload?

 
0
  #4
Jun 16th, 2008
Well I did increase
post_max_size = 100M
as well as
upload_max_filesize = 50M
and it still doesn't upload the larger file, only the smaller one...
The man who in view of gain thinks of righteousness; who in the view of danger is prepared to give up his life; and who does not forget an old agreement however far back it extends - such a man may be reckoned a complete man.
~ Confucius, The Confucian Analects
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 478
Reputation: maydhyam is an unknown quantity at this point 
Solved Threads: 1
maydhyam's Avatar
maydhyam maydhyam is offline Offline
Posting Pro in Training

Re: Would the file size affect the upload?

 
0
  #5
Jun 17th, 2008
I also increased
memory_limit
and
max_execution_time
and nothing seems to work...
Last edited by maydhyam; Jun 17th, 2008 at 11:03 am.
The man who in view of gain thinks of righteousness; who in the view of danger is prepared to give up his life; and who does not forget an old agreement however far back it extends - such a man may be reckoned a complete man.
~ Confucius, The Confucian Analects
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,744
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 330
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: Would the file size affect the upload?

 
0
  #6
Jun 17th, 2008
Okay ! I did a quick test. I changed post_max_size to 80M and upload_max_filesize to 80M. I could upload a file of size 40mb (I didn't try 80mb!).
Upload: Toss the feather.divx
Type: video/divx
Size: 41345.8066406 Kb
Temp file: C:\wamp\tmp\php29.tmp
Stored in: upload/Toss the feather.divx
Maybe, You are using something like this ?
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 478
Reputation: maydhyam is an unknown quantity at this point 
Solved Threads: 1
maydhyam's Avatar
maydhyam maydhyam is offline Offline
Posting Pro in Training

Re: Would the file size affect the upload?

 
0
  #7
Jun 17th, 2008
No, I didn't use a hidden input...
here's my code...

  1. <tr>
  2. <td colspan="6">
  3. <form action="<? echo $_SERVER['REQUEST_URI']; ?>" enctype="multipart/form-data" method="post">
  4. <table>
  5. <tr>
  6. <td>
  7. <p align="left"><span class="style4 style25 style28">Bill Uploader</span></p>
  8. <p align="left"><span class="style21 style29">The Bill Uploader works in 2 steps.</span></p> </td>
  9. </tr>
  10. <tr><td><p>&nbsp;</p></td></tr>
  11. <tr>
  12. <td>
  13. <table width="950" border="0" align="center" cellpadding="1" cellspacing="0" >
  14. <tr>
  15. <td><p>&nbsp;</p></td>
  16. <td colspan="4" bgcolor="#006600">
  17. <p align="left" class="style32">
  18. <span class="style21 style33">Step 1: Browse for file</span></p> </td>
  19. <td><p>&nbsp;</p></td>
  20. </tr>
  21. <tr>
  22. <td><p>&nbsp;</p></td>
  23. <td bgcolor="#006600"><p>&nbsp;</p></td>
  24. <td width="125" bgcolor="#006600" scope="row"><div align="left" class="style13 style29 style31">Browse</div></td>
  25. <td width="356" bgcolor="#006600">
  26. <div align="left">
  27. <strong>
  28. <input type="file" name="file" />
  29. </strong> </div> </td>
  30. <td bgcolor="#006600"><p>&nbsp;</p></td>
  31. <td><p>&nbsp;</p></td>
  32. </tr>
  33. <tr width="950">
  34. <td><p>&nbsp;</p></td>
  35. <td colspan="4" bgcolor="#006600">
  36. <p align="left"><strong>
  37. <span class="style21 style30">Step 2: Upload the file selected</span></strong></p> </td>
  38. <td><p>&nbsp;</p></td>
  39. </tr>
  40. <tr>
  41. <td><p>&nbsp;</p></td>
  42. <td bgcolor="#006600"><p>&nbsp;</p></td>
  43. <td bgcolor="#006600"><p>&nbsp;</p></td>
  44. <td bgcolor="#006600">
  45. <div align="left">
  46. <strong>
  47. <input type="submit" value="Upload" name="btnSubmit" />
  48. </strong> </div> </td>
  49. <td bgcolor="#006600"><p>&nbsp;</p></td>
  50. <td><p>&nbsp;</p></td>
  51. </tr>
  52. </table> </td>
  53. </tr>
  54. </table>
  55. </form> </td>
  56. </tr>
  57. <tr>
  58. <td colspan="6" >
  59.  
  60. <div align="left" class="style29">
  61. <?
  62. include ("./connect.php");
  63. global $conn;
  64. ini_set("display_errors", "1");
  65. error_reporting (E_ALL);
  66.  
  67. if(count($_FILES) > 0)
  68. {
  69. $ext = "";
  70. $ext = substr(trim($_FILES["file"]["name"]), -4);
  71. $allowedext = array(".txt", ".csv", ".sql");
  72.  
  73. if(in_array($ext, $allowedext))
  74. {
  75. $filename = $_FILES['file']['tmp_name'];
  76. //$fh = fopen($_FILES['file']['tmp_name'], 'r');
  77. $handle = fopen($filename, "r");
  78.  
  79. while (($data = fgetcsv($handle, 100000, ',', '"')) !== FALSE)
  80. {
  81. $query = "INSERT INTO testtsttbills VALUES ('". implode("','", $data)."')";
  82. $query = @mysql_query($query,$conn);
  83. }
  84. //$contents = fread($handle, filesize($filename));
  85. fclose($handle);
  86. //echo $contents;
  87. echo "<div align='center'><font color='red'>The file was uploaded.</font></div>";
  88. }
  89. else
  90. {
  91. echo "<div align='center'><font color='red'>You are trying to upload an invalid file format. Please try again.</font></div>";
  92. }
  93. }
  94. ?>
  95. </div></td>
  96. </tr>
  97. <tr><td colspan="6">&nbsp;</td></tr>
The man who in view of gain thinks of righteousness; who in the view of danger is prepared to give up his life; and who does not forget an old agreement however far back it extends - such a man may be reckoned a complete man.
~ Confucius, The Confucian Analects
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,744
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 330
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: Would the file size affect the upload?

 
0
  #8
Jun 17th, 2008
I checked your code, replaced your query with move_uploaded_file. It worked fine. I believe something is going wrong in the insert query. Print out the query, remove @ from mysql_query, use die(mysql_error()); . Everything else seems fine.
Here is the edited code. Try it out. If it uploads the file, then you know where the problem is!
  1. <tr>
  2. <td colspan="6">
  3. <form action="<? echo $_SERVER['REQUEST_URI']; ?>" enctype="multipart/form-data" method="post">
  4. <table>
  5. <tr>
  6. <td>
  7. <p align="left"><span class="style4 style25 style28">Bill Uploader</span></p>
  8. <p align="left"><span class="style21 style29">The Bill Uploader works in 2 steps.</span></p> </td>
  9. </tr>
  10. <tr><td><p>&nbsp;</p></td></tr>
  11. <tr>
  12. <td>
  13. <table width="950" border="0" align="center" cellpadding="1" cellspacing="0" >
  14. <tr>
  15. <td><p>&nbsp;</p></td>
  16. <td colspan="4" bgcolor="#006600">
  17. <p align="left" class="style32">
  18. <span class="style21 style33">Step 1: Browse for file</span></p> </td>
  19. <td><p>&nbsp;</p></td>
  20. </tr>
  21. <tr>
  22. <td><p>&nbsp;</p></td>
  23. <td bgcolor="#006600"><p>&nbsp;</p></td>
  24. <td width="125" bgcolor="#006600" scope="row"><div align="left" class="style13 style29 style31">Browse</div></td>
  25. <td width="356" bgcolor="#006600">
  26. <div align="left">
  27. <strong>
  28. <input type="file" name="file" />
  29. </strong> </div> </td>
  30. <td bgcolor="#006600"><p>&nbsp;</p></td>
  31. <td><p>&nbsp;</p></td>
  32. </tr>
  33. <tr width="950">
  34. <td><p>&nbsp;</p></td>
  35. <td colspan="4" bgcolor="#006600">
  36. <p align="left"><strong>
  37. <span class="style21 style30">Step 2: Upload the file selected</span></strong></p> </td>
  38. <td><p>&nbsp;</p></td>
  39. </tr>
  40. <tr>
  41. <td><p>&nbsp;</p></td>
  42. <td bgcolor="#006600"><p>&nbsp;</p></td>
  43. <td bgcolor="#006600"><p>&nbsp;</p></td>
  44. <td bgcolor="#006600">
  45. <div align="left">
  46. <strong>
  47. <input type="submit" value="Upload" name="btnSubmit" />
  48. </strong> </div> </td>
  49. <td bgcolor="#006600"><p>&nbsp;</p></td>
  50. <td><p>&nbsp;</p></td>
  51. </tr>
  52. </table> </td>
  53. </tr>
  54. </table>
  55. </form> </td>
  56. </tr>
  57. <tr>
  58. <td colspan="6" >
  59.  
  60. <div align="left" class="style29">
  61. <?
  62. /*
  63. include ("./connect.php");
  64. global $conn;
  65. */
  66. ini_set("display_errors", "1");
  67. error_reporting (E_ALL);
  68.  
  69. if(count($_FILES) > 0)
  70. {
  71. $ext = "";
  72. $ext = substr(trim($_FILES["file"]["name"]), -4);
  73. $allowedext = array(".txt", ".csv", ".sql");
  74.  
  75. if(in_array($ext, $allowedext))
  76. {
  77. $filename = $_FILES['file']['tmp_name'];
  78.  
  79. /*
  80. //$fh = fopen($_FILES['file']['tmp_name'], 'r');
  81. $handle = fopen($filename, "r");
  82.  
  83. while (($data = fgetcsv($handle, 100000, ',', '"')) !== FALSE)
  84. {
  85. echo $query = "INSERT INTO testtsttbills VALUES ('". implode("','", $data)."')";
  86. echo "<br>";
  87. //$query = @mysql_query($query,$conn);
  88. }
  89. //$contents = fread($handle, filesize($filename));
  90. fclose($handle);
  91. */
  92. move_uploaded_file($filename,"upload/".$_FILES['file']['name']);
  93. //echo $contents;
  94. echo "<div align='center'><font color='red'>The file was uploaded.</font></div>";
  95. }
  96. else
  97. {
  98. echo "<div align='center'><font color='red'>You are trying to upload an invalid file format. Please try again.</font></div>";
  99. }
  100. }
  101. ?>
  102. </div></td>
  103. </tr>
  104. <tr><td colspan="6">&nbsp;</td></tr>
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 478
Reputation: maydhyam is an unknown quantity at this point 
Solved Threads: 1
maydhyam's Avatar
maydhyam maydhyam is offline Offline
Posting Pro in Training

Re: Would the file size affect the upload?

 
0
  #9
Jun 17th, 2008
please correct me if I am wrong, but are you trying to upload and store a file?

I am trying to upload and store the data within the selected file...
The man who in view of gain thinks of righteousness; who in the view of danger is prepared to give up his life; and who does not forget an old agreement however far back it extends - such a man may be reckoned a complete man.
~ Confucius, The Confucian Analects
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,744
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 330
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: Would the file size affect the upload?

 
0
  #10
Jun 17th, 2008
Yep. I am trying to upload a file. It doesn't really matter what you do with the uploaded file. You can either upload/store it on the file system or open it and process the data in the file. I believe the problem is with the query and not the file upload.
Btw, check if you have specified a tmp folder path (upload_tmp_dir) in php.ini .
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC