Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Upload - Limited to 12 files

Status
Not open for further replies.

MikeKohler

Technical User
Jun 22, 2001
115
CA
I have a section of my website where logged in users can upload files to a set directory. None of the files being uploaded are very big, the biggest is 92 kb, and together the size is around 800kb. But there seems to be a limit on the number of files that can be uploaded, after 12 files nothing happens when a file is uploaded. No error message pops up, the file is just not there. Is there a limit to the number of files that can be uploaded to a folder?
Thank you,
Michael Kohler
 
Are all the files being uploaded at once or singly?
If all at once how are the files listed?
Have you hit a string length limit in the transfer request?
All guess work, I am afraid, without more information.

Keith
 
Thanks for the response. The files are being uploaded singly. It doesn't make sense from a size issue, I've uploaded files that are larger than 800 kb, it only becomes an issue when there are 12 files in the directory.
 
This is the code that I use to upload the files:

<?php //Script 11.4 - upload_file.php

// Address error handling.
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);

if (isset ($_POST['submit'])) { //Handle form.

// Try to move uploaded form.
if (move_uploaded_file ($_FILES['thefile']['tmp_name'], "./uploads/{$_FILES['thefile']['name']}")) {

include ("file_index.php");

} else { // Problem!

print '<p>Your file could not be uploaded because: <b>';

// Print a message based upon the error.
switch ($_FILES['thefile']['error']) {
case 1:
print 'The file exceeded the upload_max_filesize setting in php.ini';
break;
case 2:
print 'The file exceeds the MAX_FILE_SIZE setting in the HTML form';
break;
case 3:
print 'The file was only partially uploaded';
break;
case 4:
print 'No file was uploaded';
break;
}
print '</b>.</p>';
}
} // End of SUBMIT IF
// Leave the form and display the form
?>
 
is it possible that the nth file has the same 'name' as a file preceding it? and thus the move_uploaded_file call will overwrite the previous?
 
Hi, thanks for your help. I figured it out. When I upload, it calls a function that deals with the file. Since I have multiple folders, each folder has a seperate function. I called the wrong function, and the uploaded file was being sent to the wrong folder. I didn't notice it before, because I had manually placed the first files in this folder using Dreamweaver. I hope I didn't waste too much of your time.
 
add some debugging to the code, before the include. echo out the contents of the $_FILES superglobal and a directory read of the upload directory (ideally do this before and after the move_uploaded_files() call.

i still think there may be a file overwrite happening if you are not getting any other errors. try just checking with

Code:
clearstatcache();
if (file_exists('./uploads/'.$_FILES['thefile']['name']){ die ("stopped to prevent an overwrite");
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top