In Progress

Update Image upload routines php4 to php5

This is simple job I have all the code changes (see below) required to fix a broken upload routine on websites moved from php4 to php5. Its a matter of going through all the code and changing.

Please keep cost down I am on limited budget!!!

There are 13 websites that require updating all written by same developer with same routines.

Once one is done same files will transport over to the other 12.

Just check if any extra routines were written. I think the entire job will take 6 to 10 hours, I can do it myself but too busy and I am not a expert in php so easy for me to mess up.

I will give ssh access to make changes easy and fast for u, Just tar the html folder first and carry on

50% of the changes were done on one website, the guy I hired is too busy to finish as has to go to an event for his current company.

=== HTML ===

<form action='[url removed, login to view]' method=POST ENCTYPE='multipart/form-data'

...

<input type=file name=image size=50>

=== /HTML ===

In PHP/FI, and supported as compatibility in all of PHP3, and certain

cases for PHP4, the above would result in a global variable called

'$image' being created, containing the path to a temporary local copy of

the file on the server.

In PHP4, a safer way to deal with file uploads was introduced, the

$_FILES nested associative array.

The HTML above now results in the following structure:

$_FILES = Array

(

[image] => Array

(

[name] => "filename.jpg" (original name from user)

[type] => "image/jpeg" (original file type)

[tmp_name] => "/tmp/php...." (path for temp local copy)

[error] => UPLOAD_ERR_OK (=0)

[size] => xxx (size in bytes)

)

);

Also, if your ORIGINAL variable names contain an array index like:

<input type=file name=image[0] size=50>

<input type=file name=image[1] size=50>

Then there is one more level of nesting at the bottom:

$_FILES = Array

(

[image] => Array

(

[name] => Array

(

[0] => "filename1.jpg"

[1] => "filename2.jpg"

)

(same for the other keys)

)

)

So in the upgrade work, you need to follow a process similar to the

following:

0. Make a backup of the file before you edit it.

1. Identify all FORMS that allow uploading.

2. Trace what PHP files those forms submit to

(NOT the pages that generate them).

e.g.: [url removed, login to view] from the above HTML.

3. Identify the variables/form inputs that contain upload files.

(Look for <input> elements with "type=file".)

4. Trace the variable names in the target scripts.

("name=image" in the example above).

4.1. The may be trivial, such as '$image', but the variables MAY also be

constructed with eval, or a string lookup in the _GLOBALS array.

(see examples below)

4.2. If you see OTHER usage of file type, size and original name, watch

out too!

5. Before first usage or creation of the variable setup, convert the

code to the new style by taking the variable name, say 'FOO', and

doing:

$FOO = $_FILES['FOO']['tmp_name'];

OR

$FOO[0] = $_FILES['FOO']['tmp_name'][0];

(the latter case for the array index discussion above).

5.1. Similar fixes for other parts of the _FILES array.

Below are examples of the different kinds of usage I've seen thus far in your

codebase while simply fixing it for you. It wouldn't surprise me if there are

other variants as well.

Example of the GLOBALS usage, from [url removed, login to view]:

====

$fname=userfile;

$filename = $GLOBALS[$fname];

===

$fname=image;

$filename5 = $_GLOBALS[$fname];

====

Solutions:

====

$filename = $_FILES['userfile']['tmp_name'];

====

$filename5 = $_FILES['image']['tmp_name'];

====

Example of nested usage, from [url removed, login to view]:

====

$filename = $image[$i];

====

Solution:

====

$filename = $_FILES['image']['tmp_name'][$i];

====

Example of eval() usage AND other variables, from [url removed, login to view]:

======

$index = array("file", "name", "size", "type");

for($i = 0; $i < 4; $i++) {

$file_var = '$' . $filename . (($index[$i] != "file") ? "_" . $index[$i] : "");

eval('global ' . $file_var . ';');

eval('$this->file[$index[$i]] = ' . $file_var . ';');

}

======

Solution:

======

$this->file["file"] = $_FILES[$filename]['tmp_name'];

$this->file["name"] = $_FILES[$filename]['name'];

$this->file["type"] = $_FILES[$filename]['type'];

$this->file["size"] = $_FILES[$filename]['size'];

======

Skills: Linux, PHP

See more: php5 image upload, image validate upload php5, php4 upload, what is multipart form-data, what is a temp, website down for me fix, watch-it-now, up string, temp work, temporary job, target solutions, string in data structure, string data structure, require a html 5 website developer, process data structure, php string to html, php5.0, one more level, new hired, kinds of data structure, keep busy, index data structure, image websites, hired out, fixing websites

About the Employer:
( 14 reviews ) Maple Ridge, Canada

Project ID: #602259

9 freelancers are bidding on average $51 for this job

jeevanoss

Pls see the PMB

$40 USD in 1 day
(39 Reviews)
6.2
NeoWebSoftware

Hello! I am experience PHP Developer. I can do this job with quality and within the deadlines. If you check my feedbacks you will beleive in me. Thank you!

$75 USD in 2 days
(58 Reviews)
5.7
santakamal

I am well expert in PHP, MYSQL. I am confident that I can do this project. I have done several project on uploading image in image gallery. So please reply. Thanks

$55 USD in 2 days
(7 Reviews)
4.1
nukecoder

Hi, I can do it efficiently within timeline. Lets Start. Thanks

$60 USD in 1 day
(14 Reviews)
4.0
kraxor

Hi, we can start right away, it will be done in a few hours.

$30 USD in 0 days
(2 Reviews)
3.7
VIServices

Greetings! We, at V I Services, have been delivering Remote IT infrastructure Management (RIM) Services successfully to clients across the globe. Our experienced Windows and Linux Support team members with the su More

$75 USD in 3 days
(5 Reviews)
3.4
ehousesol

please see pmb for more.

$50 USD in 0 days
(7 Reviews)
2.9
dpacmittal

Please check you pmb. Regards

$40 USD in 0 days
(1 Review)
0.0
toronto0032

Hi please See pm Thank you

$30 USD in 1 day
(0 Reviews)
0.0