Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #9356

Re: mkdir no such file or directory

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.mixmin.net!news2.arglkargh.de!noris.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="UTF-8"
Message-ID <7303141.T0OLTIN1oa@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <php@PointedEars.de>
Organization PointedEars Software (PES)
Date Wed, 15 May 2013 18:37:15 +0200
User-Agent KNode/4.10.2
Content-Transfer-Encoding 8Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject Re: mkdir no such file or directory
Newsgroups comp.lang.php
References <a47b8f8a-1bd8-45c2-8edc-dd5fa2934203@googlegroups.com> <1d2ec34d-5532-4576-bcce-8c0cb77637ab@googlegroups.com> <kmvvk3$8so$1@dont-email.me> <TpSdnW030t12Dw7MnZ2dnUVZ_q2dnZ2d@giganews.com> <6377e853-a93c-47d9-953b-5a53ea8d641a@googlegroups.com> <a880675e-703c-4890-bd58-c41e9c76cfba@googlegroups.com>
MIME-Version 1.0
Lines 52
NNTP-Posting-Date 15 May 2013 18:37:16 CEST
NNTP-Posting-Host 646aec5d.newsspool4.arcor-online.net
X-Trace DXC=NFa9W4nAUR8U`5g[@c]@J14IUK<Cl32<14Fo<]lROoR18kF<OcfhCO;IHeiH@`A^P6DZm8W4\YJN<b@mF9jNikd5BoKGPB=12A7@18T0LC_aY<
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.php:9356

Show key headers only | View raw


Bhushan N.N wrote:

> ie, if my website is called example, the structure will be
> 
> example
>   index.php
>   upload.php
>   search.php
>   uploads
>     12209214
>        somefile.txt
>     31231203
>        otherfile.txt
>   about.php
>   contact.php

Please learn how to post properly on Usenet.  Avoid Google Groups in favor 
of a locally installed newsreader application if possible.

The problem here is that you are falsely assuming that “/” refers to the 
document root.  Instead, it refers to the *filesystem* root, where you/the 
Web server SHOULD NOT have write access.  As “uploads” is a directory on the 
same level as upload.php, it is probably easiest for you just to omit the 
leading “/”.  

However, it would be safest to refer to the document root explicitly, like

  $_SERVER['DOCUMENT_ROOT'] . '/uploads/' . $value

(As you can see, it does not make sense to concatenate '/uploads' . '/' when 
you can just write '/uploads/'.)

It also does not make a lot of sense to create a directory for every second 
of upload since epoch, using time().  If you need to group uploads by date 
for quick access, I suggest you use year/month/date instead.  That said, you 
can rather easily filter an array of file information, so unless there is a 
chance that on different times people would upload files with the *same* 
name where they do *not* want to overwrite the old version, you do not need 
that directory structure.

However, in a multi-user application another piece is missing in any case: 
You need a way to differentiate between the files of users or one user could 
overwrite the file of another.  Using time() _cannot_ prevent that from 
happening, because there is the possibility of concurrent access.


PointedEars
-- 
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

mkdir no such file or directory "Bhushan N.N" <bhushan154@gmail.com> - 2013-05-14 20:04 -0700
  Re: mkdir no such file or directory "Bhushan N.N" <bhushan154@gmail.com> - 2013-05-14 20:06 -0700
    Re: mkdir no such file or directory "J.O. Aho" <user@example.net> - 2013-05-15 06:34 +0200
    Re: mkdir no such file or directory Richard Yates <richard@yatesguitar.com> - 2013-05-14 21:37 -0700
    Re: mkdir no such file or directory Martin Leese <please@see.Web.for.e-mail.INVALID> - 2013-05-14 22:39 -0600
    Re: mkdir no such file or directory Arno Welzel <usenet@arnowelzel.de> - 2013-05-15 12:05 +0200
    Re: mkdir no such file or directory The Natural Philosopher <tnp@invalid.invalid> - 2013-05-15 11:23 +0100
    Re: mkdir no such file or directory Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-15 12:38 +0000
      Re: mkdir no such file or directory Robert Heller <heller@deepsoft.com> - 2013-05-15 08:51 -0500
        Re: mkdir no such file or directory "Bhushan N.N" <bhushan154@gmail.com> - 2013-05-15 08:19 -0700
          Re: mkdir no such file or directory "Bhushan N.N" <bhushan154@gmail.com> - 2013-05-15 08:20 -0700
            Re: mkdir no such file or directory Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-15 18:37 +0200
              Re: mkdir no such file or directory "Bhushan N.N" <bhushan154@gmail.com> - 2013-05-15 16:20 -0700
                Re: mkdir no such file or directory Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-15 23:55 +0000
            Re: mkdir no such file or directory Robert Heller <heller@deepsoft.com> - 2013-05-15 13:44 -0500
              Re: mkdir no such file or directory Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-15 21:31 +0200

csiph-web