Jump to content

Upload dying half way


Recommended Posts


I have a code to upload files to a directory after is created. It works great with small files. After I try uploading a 30Mb file and it dies with the following error:


Notice: Undefined index: ticketnumber in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\secure\logs\uploader.php on line 45


Here is my code:


$ticket_number = $_POST['ticketnumber'];

$target_path = "uploads/$ticket_number/";

$filename = basename($_FILES['uploadedfile']['name']);

//Check the form for completion of fields
If (!$_POST['ticketnumber']){
echo "<center><b>Error: Please enter a valid ticket number"; 

}elseif (!$_FILES['uploadedfile']['tmp_name']){
echo "<center><b>Error: Please select the file by clicking on the Browse button"; 

} else {

//If the directory with the ticket number does not exists one is created
if (!file_exists($target_path)) {

chdir ("D:/");
mkdir("uploads/$ticket_number", 0777);

                chmod("uploads/", 0777);
chmod("uploads/$ticket_number", 0777);


//Check if the file name inside the directory already exists
if (file_exists($filename)) {

echo "<center><b>There is a file in your same directory already uploaded with the same name, please change the name and try again!</b>";
echo getcwd() . "<br>";

                }else {

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 


//Move the file to the path selected above						
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
					echo "The file ".  basename( $_FILES['uploadedfile']['name']). " has been uploaded<br><br>";
echo "Upload: " . $_FILES["uploadedfile"]["name"] . "<br />";
echo "Type: " . $_FILES["uploadedfile"]["type"] . "<br />";
echo "Size: " . ($_FILES["uploadedfile"]["size"] / 1024) . " Kb<br />";

} else{

echo "There was an error uploading the file, please try again!";
echo "If the error persists please contact Rogers ESC at 1-866-939-3282";



Any ideas what is happening?

Is it a server side problem?


This is a windows server.





Link to comment
Share on other sites


I changed it to


; Maximum allowed size for uploaded files.

upload_max_filesize = 200M


; Maximum size of POST data that PHP will accept.

post_max_size = 200M


Now my code stops in the middle giving my own error:


Error: Please select the file by clicking on the Browse button


}elseif (!$_FILES['uploadedfile']['tmp_name']){
echo "<center><b>Error: Please select the file by clicking on the Browse button"; 


Thanks for your help,





Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.