Urgent Help. File upload issue

Hi All,
I am uploading a file and saving it to directory. The file size is 160 MB. I have also done php.ini settings for large file upload
post_max_size = 300M
upload_max_filesize = 300M
max_execution_time = 3600
memory_limit = 256M

When execute script using localhost, it is running and file is stored on server. When I execute script using URL, it is not uploading this file on the server.

However, if I upload a file with size around 2-3 MB using URL, it uploads file on server.

What I am doing wrong. Please help.

Thanks in advance.

On your server, before using the script, try setting the following:

<?php
error_reporting(-1); 
ini_set("display_errors", "true");
// your script

The error or warning should help in diagnosing the problem.

This is set in my script. However, I am getting blank page. No error
my uploadfile.php

<form action="process.php" method="post" enctype="multipart/form-data" id="frmViator">
    <input type="hidden" name="hiddenFileName" id="hiddenFileName" value=""/>
        <input name="csvFile" type="file" id="csvFile" onChange="return checkFileExtensionCSV(this);" />
        <input name="submit" type="submit" value="Upload"/>
    </form>

and my process.php

<?php
//set_time_limit(0);
error_reporting(-1);
ini_set( "display_errors" , 1 );
ini_set("memory_limit",'256M');
ini_set('upload_max_filesize', '200M');
ini_set('post_max_size', '200M');
ini_set('max_input_time', 3600);
ini_set('max_execution_time', 3600);

if(!empty($_FILES['csvFile'])){
    
    if(isset($_FILES["csvFile"]["error"]) && $_FILES["csvFile"]["error"] > 0){
        
        echo "Error:No file uploaded.<br>";
        
    } else{
        // NO ERROR
        
        if(is_uploaded_file($_FILES["csvFile"]["tmp_name"])){
            // DLETE EXISTING FILE IF EXITS
            if(file_exists("../../Export File/" . $_FILES["csvFile"]["name"])){
                // File Exists. Rename the file first. Remember to delete aftre successful insert.
                $oldfilename = "testcsv-".time(). ".csv";
                rename("../../Export File/" .$_FILES["csvFile"]["name"], "../../Export File/oldcsvfile/" . $oldfilename);
                // Proceed with upload
                move_uploaded_file($_FILES["csvFile"]["tmp_name"], "../../Export File/" . $_FILES["csvFile"]["name"]);
                echo "File uploaded successfully.";
            } else {
                // Proceed with upload
                move_uploaded_file($_FILES["csvFile"]["tmp_name"], "../../Export File/" . $_FILES["csvFile"]["name"]);
                echo "File uploaded successfully.";
            }
        } else {
            
            echo "no uploaded file";
        }
        
    }    
}

?>

I have also tried above settings in php.ini but same issue.

Please help.

The ini_set("display_errors". "true"); should stop the script and show errors or warnings.

Try inserting a break using die(); in the script where the script fails.

Does your host allow the settings to be modified in the way that you are doing? That is, do they have an “overall” limit to upload file size or duration that overrides your own settings?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.