Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

wwwxxx0cm, www.webdp.net, Event 9 IIS log failed to write entry, wwwxxx jeffs, Catastrophic failure Unexpected method call sequence. 0x8000ffff (-2147418113)., ksh lock a file, [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_DBC failed, sed: -e expression #1, char 1: unterminated address regex, procmail + change subject, w2ksp4.exe download

Links

XODOX
Impressum

#1: cant find uploaded file in /tmp.

Posted on 2010-10-03 19:53:38 by aprekates

Hi to the list.

Trying to test php upload i used a very simple scrip.
I managed to upload files but i dont understand why the dont
stay in the /tmp dir where the initialy are put even if i dont move them
to another dir.

alex.

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

Report this message

#2: Re: cant find uploaded file in /tmp.

Posted on 2010-10-03 20:16:02 by Ashley Sheridan

--=-O2h63rNkAaYa9a51CxLX
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit

On Sun, 2010-10-03 at 20:53 +0300, Prekates Alexandros wrote:

> Hi to the list.
>
> Trying to test php upload i used a very simple scrip.
> I managed to upload files but i dont understand why the dont
> stay in the /tmp dir where the initialy are put even if i dont move them
> to another dir.
>
> alex.
>


Files are put into the /tmp directory by Apache, before PHP is even
aware of them. Unless you create a copy of the file, then Apache will
clean it up after your script has run (or at least it's supposed to, but
sometimes /tmp becomes a little cluttered with crud)

The best thing to do is to use move_uploaded_file to move the file to
someplace, and give the file a new name (or keep the same one and add an
extension if you want to ensure the file is given a unique name in the
directory you're putting it into)

There are lots of different scripts on the manual page for
move_uploaded_file if you're feeling a little stuck. As a safety
precaution, it's considered good practice to copy the file to a location
outside of your document root. So if your document root
is /var/www/html/ then maybe put the file in /var/www/user_files/ . This
means that people can't use your website to upload their own scripts and
gain access to your server, although it does mean you need to find an
alternative way to serve up that file if you need, but that is quite
easy, and there are lots of example scripts about for that if you need;
many people on the list have written their own, and Tedd most likely has
an example somewhere too!

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-O2h63rNkAaYa9a51CxLX--

Report this message

#3: Re: cant find uploaded file in /tmp.

Posted on 2010-10-04 16:20:01 by TedD

At 7:16 PM +0100 10/3/10, Ashley Sheridan wrote:
>On Sun, 2010-10-03 at 20:53 +0300, Prekates Alexandros wrote:
>
>> Hi to the list.
>>
>> Trying to test php upload i used a very simple scrip.
>> I managed to upload files but i dont understand why the dont
>> stay in the /tmp dir where the initialy are put even if i dont move them
>> to another dir.
>>
>> alex.
>>
>
>
>Files are put into the /tmp directory by Apache, before PHP is even
>aware of them. Unless you create a copy of the file, then Apache will
>clean it up after your script has run (or at least it's supposed to, but
>sometimes /tmp becomes a little cluttered with crud)
>
>The best thing to do is to use move_uploaded_file to move the file to
>someplace, and give the file a new name (or keep the same one and add an
>extension if you want to ensure the file is given a unique name in the
>directory you're putting it into)
>
>There are lots of different scripts on the manual page for
>move_uploaded_file if you're feeling a little stuck. As a safety
>precaution, it's considered good practice to copy the file to a location
>outside of your document root. So if your document root
>is /var/www/html/ then maybe put the file in /var/www/user_files/ . This
>means that people can't use your website to upload their own scripts and
>gain access to your server, although it does mean you need to find an
>alternative way to serve up that file if you need, but that is quite
>easy, and there are lots of example scripts about for that if you need;
>many people on the list have written their own, and Tedd most likely has
>an example somewhere too!
>
>Thanks,
>Ash


Ash:

Thanks for the plug. The code is pretty simple.

If the "simple script" the OP used did indeed move the file to the
tmp directory, then it should be there for him to see.

I suspect that: 1) the upload script is not working properly; 2) or
the OP needs to refresh his IDE to reflect changes made to the server.

Cheers,

tedd

--
-------
http://sperling.com/

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

Report this message