Jump to content

[SOLVED] Upload work in one envirunment and does not in other


mohammed.yahya

Recommended Posts

Hi All,

 

I have a code that upload MS excel file. I tried it in two envirunment.

1-PHP 5

2- PHP 4

 

It worked with the first envirunment. But, it does not upload with the second one. Below is the code:

 

Form Code:

<form name="exc_upload" method="post" action="upload_file.php" enctype="multipart/form-data">

 

<tr><td><strong>تحميل الملف:</strong></td><td><input type="file" size=30 name="excel_file"></td></tr>

<tr><td></td><td></td></tr>

<tr><td colspan="2"  height="49" align="left">

<input type="hidden" name="step" value="1">

<input type="hidden" name="rmB" value="$rmB">

<input type="hidden" name="projectId" value="$projectId">

<input type="button" value="التالي" onClick="

javascript:

if( (document.exc_upload.excel_file.value.length==0))

{ alert('You must specify filename first'); return; }; submit();

"></td></tr>

 

 

</form>

 

Action code:

$excel_file = $_FILES["excel_file"];

if( $excel_file )

$excel_file = $_FILES["excel_file"]["tmp_name"];

 

if(empty($excel_file)) fatal("No file uploaded");

 

 

The output that I got in the second envirunment is :No file uploaded

 

I checked that the file uploads in php.ini is On and the maximum size is withing the range.

 

What could be the problem? please, help me.

 

thanks

After adding the code you  gave me. This is the output:

 

POST:Array

(

    [step] => 1

    [rmB] => 1

    [projectId] => 455

)

FILES:Array

(

    [excel_file] => Array

        (

            [name] => test.xls

            [type] => application/vnd.ms-excel

            [tmp_name] => /tmp/phpy2kaOM

            [error] => 0

            => 17920

        )

 

)

 

Thanks for your help. Now, is the problem clear?

Using :error_reporting(E_ALL);

 

The output is:

 

Warning: move_uploaded_file(upload/test.xls): failed to open stream: Permission denied in /var/www/html/master/RMS/upload_file.php on line 214

 

Warning: move_uploaded_file(): Unable to move '/tmp/phpBdOb9N' to 'upload/test.xls' in /var/www/html/master/RMS/upload_file.php on line 214

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.