|
Posted by petersprc on 10/09/06 03:19
Error code 2 means the uploaded file was bigger than the MAX_FILE_SIZE
form directive, which in your case was about 1.2 MB.
Upload error codes explained:
http://us3.php.net/manual/en/features.file-upload.errors.php
On Oct 8, 11:02 pm, "Shelly" <sheldonlg.n...@asap-consult.com> wrote:
> <peters...@gmail.com> wrote in messagenews:1160349587.512660.324520@e3g2000cwe.googlegroups.com...
>
> > 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).I did this and error came up as "2".
>
> The upload_tmp_dir came up as blank when I did it with theo ini_get. Also,
> it was "no value" with the phpinfo. Also, phpinfo gave "On" for
> file_uploads. What else should I be looking for?
>
> Shelly
>
>
>
> > 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-exten...
>
> > 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
[Back to original message]
|