| | |
Would the file size affect the upload?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
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...
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
~ Confucius, The Confucian Analects
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
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*
*PM asking for help will be ignored*
okie dokie....I see I got some reading to do...
Will keep you posted...
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
~ Confucius, The Confucian Analects
Well I did increase as well as and it still doesn't upload the larger file, only the smaller one...
•
•
•
•
post_max_size = 100M
•
•
•
•
upload_max_filesize = 50M
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
~ Confucius, The Confucian Analects
I also increased and and nothing seems to work...
•
•
•
•
memory_limit
•
•
•
•
max_execution_time
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
~ Confucius, The Confucian Analects
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!). Maybe, You are using something like this ?
•
•
•
•
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
<input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
No, I didn't use a hidden input...
here's my code...
here's my code...
php Syntax (Toggle Plain Text)
<tr> <td colspan="6"> <form action="<? echo $_SERVER['REQUEST_URI']; ?>" enctype="multipart/form-data" method="post"> <table> <tr> <td> <p align="left"><span class="style4 style25 style28">Bill Uploader</span></p> <p align="left"><span class="style21 style29">The Bill Uploader works in 2 steps.</span></p> </td> </tr> <tr><td><p> </p></td></tr> <tr> <td> <table width="950" border="0" align="center" cellpadding="1" cellspacing="0" > <tr> <td><p> </p></td> <td colspan="4" bgcolor="#006600"> <p align="left" class="style32"> <span class="style21 style33">Step 1: Browse for file</span></p> </td> <td><p> </p></td> </tr> <tr> <td><p> </p></td> <td bgcolor="#006600"><p> </p></td> <td width="125" bgcolor="#006600" scope="row"><div align="left" class="style13 style29 style31">Browse</div></td> <td width="356" bgcolor="#006600"> <div align="left"> <strong> <input type="file" name="file" /> </strong> </div> </td> <td bgcolor="#006600"><p> </p></td> <td><p> </p></td> </tr> <tr width="950"> <td><p> </p></td> <td colspan="4" bgcolor="#006600"> <p align="left"><strong> <span class="style21 style30">Step 2: Upload the file selected</span></strong></p> </td> <td><p> </p></td> </tr> <tr> <td><p> </p></td> <td bgcolor="#006600"><p> </p></td> <td bgcolor="#006600"><p> </p></td> <td bgcolor="#006600"> <div align="left"> <strong> <input type="submit" value="Upload" name="btnSubmit" /> </strong> </div> </td> <td bgcolor="#006600"><p> </p></td> <td><p> </p></td> </tr> </table> </td> </tr> </table> </form> </td> </tr> <tr> <td colspan="6" > <div align="left" class="style29"> <? include ("./connect.php"); global $conn; ini_set("display_errors", "1"); error_reporting (E_ALL); if(count($_FILES) > 0) { $ext = ""; $ext = substr(trim($_FILES["file"]["name"]), -4); $allowedext = array(".txt", ".csv", ".sql"); if(in_array($ext, $allowedext)) { $filename = $_FILES['file']['tmp_name']; //$fh = fopen($_FILES['file']['tmp_name'], 'r'); $handle = fopen($filename, "r"); while (($data = fgetcsv($handle, 100000, ',', '"')) !== FALSE) { $query = "INSERT INTO testtsttbills VALUES ('". implode("','", $data)."')"; $query = @mysql_query($query,$conn); } //$contents = fread($handle, filesize($filename)); fclose($handle); //echo $contents; echo "<div align='center'><font color='red'>The file was uploaded.</font></div>"; } else { echo "<div align='center'><font color='red'>You are trying to upload an invalid file format. Please try again.</font></div>"; } } ?> </div></td> </tr> <tr><td colspan="6"> </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
~ Confucius, The Confucian Analects
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!
Here is the edited code. Try it out. If it uploads the file, then you know where the problem is!
php Syntax (Toggle Plain Text)
<tr> <td colspan="6"> <form action="<? echo $_SERVER['REQUEST_URI']; ?>" enctype="multipart/form-data" method="post"> <table> <tr> <td> <p align="left"><span class="style4 style25 style28">Bill Uploader</span></p> <p align="left"><span class="style21 style29">The Bill Uploader works in 2 steps.</span></p> </td> </tr> <tr><td><p> </p></td></tr> <tr> <td> <table width="950" border="0" align="center" cellpadding="1" cellspacing="0" > <tr> <td><p> </p></td> <td colspan="4" bgcolor="#006600"> <p align="left" class="style32"> <span class="style21 style33">Step 1: Browse for file</span></p> </td> <td><p> </p></td> </tr> <tr> <td><p> </p></td> <td bgcolor="#006600"><p> </p></td> <td width="125" bgcolor="#006600" scope="row"><div align="left" class="style13 style29 style31">Browse</div></td> <td width="356" bgcolor="#006600"> <div align="left"> <strong> <input type="file" name="file" /> </strong> </div> </td> <td bgcolor="#006600"><p> </p></td> <td><p> </p></td> </tr> <tr width="950"> <td><p> </p></td> <td colspan="4" bgcolor="#006600"> <p align="left"><strong> <span class="style21 style30">Step 2: Upload the file selected</span></strong></p> </td> <td><p> </p></td> </tr> <tr> <td><p> </p></td> <td bgcolor="#006600"><p> </p></td> <td bgcolor="#006600"><p> </p></td> <td bgcolor="#006600"> <div align="left"> <strong> <input type="submit" value="Upload" name="btnSubmit" /> </strong> </div> </td> <td bgcolor="#006600"><p> </p></td> <td><p> </p></td> </tr> </table> </td> </tr> </table> </form> </td> </tr> <tr> <td colspan="6" > <div align="left" class="style29"> <? /* include ("./connect.php"); global $conn; */ ini_set("display_errors", "1"); error_reporting (E_ALL); if(count($_FILES) > 0) { $ext = ""; $ext = substr(trim($_FILES["file"]["name"]), -4); $allowedext = array(".txt", ".csv", ".sql"); if(in_array($ext, $allowedext)) { $filename = $_FILES['file']['tmp_name']; /* //$fh = fopen($_FILES['file']['tmp_name'], 'r'); $handle = fopen($filename, "r"); while (($data = fgetcsv($handle, 100000, ',', '"')) !== FALSE) { echo $query = "INSERT INTO testtsttbills VALUES ('". implode("','", $data)."')"; echo "<br>"; //$query = @mysql_query($query,$conn); } //$contents = fread($handle, filesize($filename)); fclose($handle); */ move_uploaded_file($filename,"upload/".$_FILES['file']['name']); //echo $contents; echo "<div align='center'><font color='red'>The file was uploaded.</font></div>"; } else { echo "<div align='center'><font color='red'>You are trying to upload an invalid file format. Please try again.</font></div>"; } } ?> </div></td> </tr> <tr><td colspan="6"> </td></tr>
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
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...
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
~ Confucius, The Confucian Analects
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 .
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*
*PM asking for help will be ignored*
![]() |
Similar Threads
- File upload help (PHP)
Other Threads in the PHP Forum
- Previous Thread: Image button
- Next Thread: display image file from mysql databse using php
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql navigation number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white xml youtube






