Avatar of cycledude
cycledude
Flag for United Kingdom of Great Britain and Northern Ireland asked on

php form submission losing data

Hi

I have a website which works fine on my dev server, however once moved to a clients server it doesn't work correctly.

I have a form that allows the client to upload files/images/video etc to the website.

now the site is live on the clients server, he cannot upload images etc... I made the upload folder write enabled, but it still did not work.

After some investigation, it turns out that $_FILES['file'[['name'] is blank... even when a file is uploaded, so my script doesn't try to do anything with the file because it thinks there isn't one.

The form has text fields as well as file upload, and the script deals with the form in a single pass.

Is this something to do with accessing other data from the form before getting the file array?

weird how the exact same code works on my dev server...

Thanks
PHP

Avatar of undefined
Last Comment
cycledude

8/22/2022 - Mon
SOLUTION
Loganathan Natarajan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Loganathan Natarajan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
cycledude

ASKER
Hi  logudotcom

thanks for the replies.  I can confirm that the textual data is passed through and updates the database fine.

the 2 servers are slightly different versions of php,

dev: php 5.3.10

client: php 5.2.16
SOLUTION
Loganathan Natarajan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
cycledude

ASKER
yes indeed

<form action='' method='post' enctype='multipart/form-data'>
SOLUTION
Loganathan Natarajan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Loganathan Natarajan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
cycledude

ASKER
Hi again

I have that one covered with a little php.ini file

<?php
upload_max_filesize = 200M ;
post_max_size = 200M ;
max_execution_time = 6000 ;
?>

Doing more investigation.... I have found something odd

there are a number of file inputs on the form, when I do a print_r($_FILES) it lists all of the file inputs except the one I am having trouble with!

could it be that this server is fussy about having a fileinput called 'file'?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER CERTIFIED SOLUTION
cycledude

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
cycledude

ASKER
right, I have checked the code and I can't see any problems (although that doesn't mean there aren't any) but at least I can now use the form to upload the file now...

there must be some malformed html in there somewhere which was causing problems along the line there somewhere...
cycledude

ASKER
thanks for the assists!