|
Posted by petersprc on 10/08/06 23:19
Maybe $_FILES['srcFile']['error'] has an error code? I would also make
sure you have write permissions to PHP's upload_tmp_dir
(ini_get('upload_tmp_dir') or phpinfo() will tell you where it is).
As for long uploads, you could warn the user that the upload may take a
while, or unhide a "Please Wait" image.
There are a couple techniques for a real upload progress indicator,
some of which are shown here:
http://devzone.zend.com/node/view/id/36
http://blog.bitflux.ch/archive/2006/09/28/upload-progress-meter-extension-for-php-5-2.html
Shelly wrote:
> I do what most programmers do -- we steal code from stuff we have written src
> 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]
|