RE: [PHP] HTTP POST FILE UPLOAD HELP - REVISITED

2002-11-09 Thread @ Darwin

You're absolutely correct. The script works perfectly fine now, and I have
you to thank. I went back to "Handling file uploads" and re-read the entire
thing. I guess I missed the part that said the following before the actual
script example. My fault and my apologies. Thanks Jason, and thanks to all
the others who replied as well.

"...Whatever the logic, you should either delete the file from the temporary
directory or move it elsewhere."
"The file will be deleted from the temporary directory at the end of the
request if it has not been moved away or renamed."






> -Original Message-
> From: Jason Wong [mailto:php-general@;gremlins.com.hk]
> Sent: Saturday, November 09, 2002 5:01 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] HTTP POST FILE UPLOAD HELP - REVISITED
>
>
> On Saturday 09 November 2002 18:39, [EMAIL PROTECTED] wrote:
> > Sorry about that guys, here is a bit more info that might be useful:
> >
> > I forgot to tell you that I'm working on a Windows XP box with
> full rights,
> > which means the default temporary directory is C:\WINDOWS\Temp and there
> > are no limitations on what I can and cannot access on the
> system (running
> > as system administrator). I did change that default to
> C:\PHP\tmp_uploads.
> > I ran this script with the default temp directory as well, same result.
>
> Assuming that you webserver really does have access to write to those
> directories then ...
>
> [snip 'simplified' code]
>
> > Here is what's happening:
> >
> > 2. When the submit button is pushed, the files are uploaded through the
> > form but the temporary file is never created on the system. I
> did a search
> > on the entire C: drive for the temporary file that should have been
> > created, but it's not there.
>
> ... you didn't read the manual like I suggested. Because
> otherwise you'll know
> that "the file will be deleted from the temporary directory at
> the end of the
> request if it has not been moved away or renamed."
>
> If you didn't 'simplify' the example and removed the all
> important copy() or
> move_uploaded_file() then you would have had something that worked!
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Mount St. Helens should have used earth control.
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] HTTP POST FILE UPLOAD HELP - REVISITED

2002-11-09 Thread Jason Wong
On Saturday 09 November 2002 18:39, [EMAIL PROTECTED] wrote:
> Sorry about that guys, here is a bit more info that might be useful:
>
> I forgot to tell you that I'm working on a Windows XP box with full rights,
> which means the default temporary directory is C:\WINDOWS\Temp and there
> are no limitations on what I can and cannot access on the system (running
> as system administrator). I did change that default to C:\PHP\tmp_uploads.
> I ran this script with the default temp directory as well, same result.

Assuming that you webserver really does have access to write to those 
directories then ...

[snip 'simplified' code]

> Here is what's happening:
>
> 2. When the submit button is pushed, the files are uploaded through the
> form but the temporary file is never created on the system. I did a search
> on the entire C: drive for the temporary file that should have been
> created, but it's not there.

... you didn't read the manual like I suggested. Because otherwise you'll know 
that "the file will be deleted from the temporary directory at the end of the 
request if it has not been moved away or renamed."

If you didn't 'simplify' the example and removed the all important copy() or 
move_uploaded_file() then you would have had something that worked!

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Mount St. Helens should have used earth control.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] HTTP POST FILE UPLOAD HELP - REVISITED

2002-11-09 Thread @ Darwin
Sorry about that guys, here is a bit more info that might be useful:

I forgot to tell you that I'm working on a Windows XP box with full rights,
which means the default temporary directory is C:\WINDOWS\Temp and there are
no limitations on what I can and cannot access on the system (running as
system administrator). I did change that default to C:\PHP\tmp_uploads. I
ran this script with the default temp directory as well, same result.

I tried the code at http://www.php.net/manual/sk/features.file-upload.php
and listed the results of the test below. I simplified the code a little,
and here it is:

--[clip
start]
 Filename: " . $_FILES['userfile']['name']
   . " Mime-Type: " . $_FILES['userfile']['type']
   . " File Size: " . $_FILES['userfile']['size'] . " bytes"
   . " Temporary File Name: " . $_FILES['userfile']['tmp_name']
   . " Error: " . $_FILES['userfile']['error'];
} else {

?>



Send this file: 




--[clip
end]


Here is what's happening:

2. When the submit button is pushed, the files are uploaded through the form
but the temporary file is never created on the system. I did a search on the
entire C: drive for the temporary file that should have been created, but
it's not there.


Here is the data received after the file is supposedly uploaded with a GIF
image:
The temporary file exists
Filename: icon_processing.gif
Mime-Type: image/gif
File Size: 408 bytes
Temporary File Name: C:/PHP/tmp_uploads\php93.tmp
Error: 0


Here is the data received after the file is supposedly uploaded with a JPG
image:
The temporary file exists
Filename: Sunset.jpg
Mime-Type: image/pjpeg
File Size: 71189 bytes
Temporary File Name: C:/PHP/tmp_uploads\php95.tmp
Error: 0



NOTE: The error code 0 means that there was no error uploading the file.

THE QUESTION: Shouldn't PHP automatically create a temporary file of the
uploaded image? Is there something I'm missing in the php.ini settings?

If you have any other questions that might help you further your probe into
this problem, please let me know. Thanks...

- Darwin


--[old
message]

> Ok, I have a problem with my file upload. When I upload a file, say $img,
> only $img is available and when I echo $img to the screen it gives the
full
> path of the temporary image "supposedly" created by PHP. Echoing
> $_FILE['img']['tmp_name'], or any of the other $_FILE array elements,
> doesn't give anything. There is no array of information for the uploaded
> file, possibly because of the following problem I'm having:
>
> Another weird thing is that no temporary file is even created on the
server
> (I did a system search on the C: drive of the windows box I'm using). Here
> is the info from my php.ini file:
>
> --
--
> ---
>
> 
> ; File Uploads ;
> 
>
> ; Whether to allow HTTP file uploads.
> file_uploads = On
>
> ; Temporary directory for HTTP uploaded files (will use system default if
> not
> ; specified).
> upload_tmp_dir = C:\PHP\tmp_uploads
>
> ; Maximum allowed size for uploaded files.
> upload_max_filesize = 6M
>
> --
--
> 
>
> I even changed the upload_tmp_dir setting to the default and it still
didn't
> create a temporary file of the image on the server. GD is definately
> installed and enabled according to phpinfo() -- although GD has nothing to
> do with this. I'm uploading *.jpg/*.jpeg files only. register_globals is
on
> (I am aware of the risks). So what could be wrong? Is there another
setting
> in the php.ini file that I need to worry about that is not set by default?
> I've pondered and tested this long enough and I'm beyond frustration,
> someone please help me with some suggestions to get me through this...
>
> Thanks,
> - Darwin


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php