|
Posted by Shelly on 10/08/06 22:19
I do what most programmers do -- we steal code from stuff we have written
before, or accept code from others that works, before we attempt to write
something altogether new.
On a previous project I wrote code to upload pictures and music from the
local drive to the server. It worked perfectly. I scarfed that code,
without changing any names, for a new project and I am running into a
problem. Here is what I have:
The form definition:
<form action="" method="post" enctype="multipart/form-data" name="History"
target="_self">
<input type="hidden" name="MAX_FILE_SIZE" value="1250000">
The file field:
<input name="srcFile" type="file" id="srcFile">
The code for the copying:
if (strlen(trim($_FILES['srcFile']['name'])) > 0) {
$tmp_photo = "pic_" . $user . "_" . $_POST['petname'] . "_" .
$_FILES['srcFile']['name'];
echo "target=" . $tmp_photo . "<br>";
echo "src=" . $_FILES['srcFile']['tmp_name'] . "<br>";
$status = copy ($_FILES['srcFile']['tmp_name'], $tmp_photo);
echo "status=" . $status . "<br>";
---- more processing follows ----
The result is:
target=pic_sheldonlg_coda_coda.jpg
src=
status=
In other words, it is not finding a value for
$_FILES['srcFile']['tmp_name'], but it is finding the value for
$_FILES['srcFile']['name'] (that value is coda.jpg and is nested a number
of directories down on the C drive).
This worked fine before. Does anything leap out at anyone?
While I am here, how do you folks handle the time delay in processing the
upload to avoid having impatient users? So far, all I am doing is putting a
message before the hit the key to do the upload.
Shelly
Navigation:
[Reply to this message]
|