Connecting Tech Pros Worldwide Forums | Help | Site Map

Uploading problem

Sheldon Glickler
Guest
 
Posts: n/a
#1: Mar 15 '06
I am having a problem uploading on one system and not on another with very
similar code in two different applications. I suspect that it has to do
with server settings.

Here is the code that works. It is on a deicated server in a private
company with the latest PHP installed.

APPLICATION #1
---------------------
if (isset($_POST['btnLgPict'])) {
$target = <define the target>
if (!copy ($_FILES['sourceLgPict']['tmp_name'], $target)) {
$_SESSION['errors'] = "The large picture did not upload to " . $target
.. "<br>";
} else {
$_SESSION['errors'] = "The file was uploaded to " . $target . "<br>";
}
}

where the item is defined as:
<input name="sourceLgPict" type="file" class="style2" id="sourceLgPict"
value="Large Picture Location on Source" size="40">


Now, on GoDaddy, this next application code does not work, (but it worked
when it was on ShieldHost), and gives empty values for the $_FILES
variables.

APPLICATION #2
---------------------
if (isset($_POST['Add'])) {
$tmp_photo = "tmp_photo/".$_SESSION['MM_Username']."_";
//diagnostics for the next two lines
echo "tmp_name = " . $_FILES['filename']['tmp_name'] . "<br>";
echo "name = " . $tmp_photo . $_FILES['filename']['name'] . "<br>";
$tmp_photo = "tmp_photo/".$_SESSION['MM_Username']."_";
$status = copy ($_FILES['filename']['tmp_name'],
$tmp_photo.$_FILES['filename']['name']);
if (!status) {
$_SESSION['MM_manageError'] = "The file " .
$_FILES['filename']['tmp_name'] .
" was NOT uploaded <br>";
}
}

where the item is defined by:
<input name="filename" type="file" id="filename">


What happens is that the $_FILES['filename']['tmp_name'] and the
$_FILES['filename']['name'] are both empty (the two echo lines are there for
diagnostics and that is how I determined that the $_FILES variables were
empty).

I don't have access to the ShieldHost any longer to see if it still works,
or to see what the differences in the settings might be between that and the
GoDaddy. Both are Linux servers and the GoDaddy is running PHP 4.3.11.

Any ideas on where to look for a solution? (Yes, I am going to submit this
as a bug to GoDaddy).

Shelly



Shelly
Guest
 
Posts: n/a
#2: Mar 15 '06

re: Uploading problem


Never mind. Pilot error (as it always is!!!!). I stupidly had an extra
form statement. That one didn't have an enctype statement, while the other
one did. When I removed that line, all went well.


----- Original Message -----
From: "Sheldon Glickler" <sheldonlg@bellsouth.net>



Closed Thread