Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #9356
| Message-ID | <7303141.T0OLTIN1oa@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2013-05-15 18:37 +0200 |
| Subject | Re: mkdir no such file or directory |
| Newsgroups | comp.lang.php |
| References | (1 earlier) <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> |
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
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